NCEAS / recordr

Provenance tracking for R.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

record() doesn't honor options(warn) setting

gothub opened this issue · comments

R option warn < 2 will allow a sourced script to run completely even if a warning is
encountered in the script. When record() sources a user script, it does so in a tryCatch
block (as required specifically of recordr by CRAN), which causes control to return from the
record() source script immediately when any warning is encountered.

To resolve this, if warn is set to < 2, record() will source the user script with suppressWarnings() so that the script can complete even if a warning is encountered. If warn >=2, then the script is
sourced without suppressWarnings() and warnings (treated as errors now) will cause the script.

The result is that running an R script directly with source() and with record() has the
same error handling behaviour, whatever the user has set option(warn) to be.

Fixed in commit b7a5e78