-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Consider adding a check that when on.exit() is called, that the add = TRUE argument is passed.
Alternative: if TRUE is too restrictive, maybe require that add = FALSE be explicitly mentioned. This should make it a little more clear to that the previous calls to on.exit() will be clobbered.
(If you give me a few pointers, I'm happy to try adding this. Right now, I don't have a good understanding how this would be checked follow this package's approach.)
Sources:
-
https://adv-r.hadley.nz/functions.html#on-exit
Always set add = TRUE when using on.exit(). If you don’t, each call to on.exit() will overwrite the previous exit handler. Even when only registering a single handler, it’s good practice to set add = TRUE so that you won’t get any unpleasant surprises if you later add more exit handlers.
-
from yihui: r-lib/yaml@67496b6
on.exit(add = TRUE) is almost always the right thing to do
Without add = TRUE, it is easy to shoot yourself in the foot when you have other
on.exit()calls.