Post #4503852
2026-04-14 22:04 UTC
TIL .Last() won't run in a non-interactive #rstats session that exits with error:
Rscript -e ".Last = \() cat('run\n'); stop('oops')"
Gemini suggested a kludgy workaround but I can't think of anything else, maybe something with options(error=...)?
Rscript -e "run_last = TRUE; reg.finalizer(.GlobalEnv, \(e) if (run_last) cat('run\n'), onexit=TRUE); stop('oops')"
My requirements are that it should (1) work in both interactive and batch sessions (2) optionally be disabled
Replies (0)
No replies.