Hi, I am using the diary function to log my application output. Something like
diary(path_to_logfile)
diary off
When the code fails, the diary is not closed. One option would be to wrap all the code on a try-catch statement and close it on the catch.
Is there another way to avoid the diary being "open" when the app fails?