Skip to content
Prev 56502 / 63421 Next

Exit status of Rscript when setting options(error=utils::recover)

Thanks for explanation,  so recover in non-interactive session exit
with 0 is expected behavior .
dump.frames said that it always write to file (workspace , or specified file).
I have a R script run as a auto build stage, so I want to print detail
backtrace to console
 (with source file, line number)  for quickly debug, without saving any dump.
I tried

options(error= quote({utils::recover;q(status=1)}))

it do exit with 1 when script has error, but it only shows a stripped
call trace like

Calls: a ... a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> apply

instead of
...
99: rec.R#5: a(v, depth - 1)
100: rec.R#5: a(v, depth - 1)
101: rec.R#5: a(v, depth - 1)
102: rec.R#5: a(v, depth - 1)
103: rec.R#5: a(v, depth - 1)

How can I resolve this ? Thanks for advise


On Fri, Mar 15, 2019 at 10:10 PM Tomas Kalibera
<tomas.kalibera at gmail.com> wrote: