Please refer to the documentation (?stop, ?recover, ?dump.frames). In non-interactive use, recover() works as dump.frames(). dump.frames() is documented not to quit R, and the examples show how to quit the R session with a given status automatically after dump.frames(). So in line with the documentation, R continues after the error, it reaches the end of the input, and returns 0.
When you run the example with the NULL default error handler (not setting the error option), the exit status is 1 as documented in ?stop.
To avoid surprise wrt to the exit status or where execution continues, it is best not to set default error handlers in non-interactive use (or set them so that they exit the session with a given exit status).
Tomas On 3/10/19 4:15 AM, comic fans wrote:
Hello, I've noticed that Rscript didn't exit with error code if I set options error = utils::recover in .Rprofile . for example Rscript -e "asdf" Error: object 'asdf' not found No suitable frames for recover() echo $? 0 if didn't set options in .Rprofile, Rscript exit with error code 1, is this expected behavior ? ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel