Closed mainej closed 6 years ago
Looks good to me but I will leave this to @levand to merge
If you call System/exit
, I think a finally
block will not be called at all.
As such, if we're always calling System/exit
explicitly, we don't even need to bother about cleaning up agents. Cleaning up agents is only necessary to allow the JVM to terminate "naturally" after the -main
function returns. So I think this can be simplified a bit by taking out the "finally" altogether.
I think the finally
block is called, because it is structured to run before the System/exit
. But it sounds reasonable that it doesn't need to be called if we're going to System/exit
. I'll submit a revision with that change.
Fixes https://github.com/cognitect-labs/test-runner/issues/9. Based on https://github.com/cognitect-labs/test-runner/pull/12, with the following differences:
shutdown-agents
runs before exiting.~System/exit
before the finally block. That approach skips the finally block (1), unlessSystem/exit
is configured to throw aSecurityException
(2), which I don't believe is the default in Clojure.~1) https://stackoverflow.com/questions/65035/does-finally-always-execute-in-java 2) https://stackoverflow.com/questions/1410951/how-does-javas-system-exit-work-with-try-catch-finally-blocks