I'm attempting to allow my application to use System.exit(<int>)
so that when run via the command line on it's own outside of SBT it return a useful exit code.
When I exit whilst running through SBT's run
command I get the following message:
Exception: sbt.TrapExitSecurityException thrown from the UncaughtExceptionHandler in thread "run-main-e"
I am aware of what this message is there for, and why it must be there.
I would like to avoid exiting if my code is being run via SBT. Is it possible to detect whether or not code is being run via SBT? If so, how?
main
can inspect the stack for sbt,Thread.currentThread.getStack
. – som-snytt