System.exit(1) shouldn't be called at the end of the ScalaBuff run
It isn't compatible with testing or programmatic access since it shuts down the whole JVM.
https://github.com/SandroGrzicic/ScalaBuff/pull/56#issuecomment-19856839
Proposed solution: throw an exception at end of execution if user specifies a "-debug" (or similar flag).
In the unix world, the exit code is returned from main(), which is easy to test for, but java doesn't allow that, so (as far as I know) System.exit() is the only way.
I like @viktorklang 's idea: rename the current "main" to "run" (or something similar), and have it throw an exception if there were any errors. Then make a new "main" that does nothing but call "run", catch exceptions, and turn that into a System.exit. You can call "run" from the tests and verify that an exception was/was-not thrown. "main" can be called from the system executable.
Great, that actually sounds reasonable and clean.
I've done some tiny amount of work on this (exams.. I'll do more in a few days, along with the OSGi ticket) and so far the main/run solution seems nice.
I really need to overhaul the (new) run method, though, it's too big.
I've also noticed that we're working on one input file at a time. Adding .par on the main processing for loop increased the performance as measured by the PerformanceTest by approx. 2x. :) It's a totally unscientific and quick&dirty test and hopefully there won't be any concurrency issues (so far all unit tests check out). But it's one of the reasons that Scala is so awesome. :)
Forgot to reference the issue from the commit: https://github.com/SandroGrzicic/ScalaBuff/commit/3244493944849e4898e8e5f36af9b96c3802d6f5
I'll probably improve the current "boolean flag" return, it reminds me too much of C programs. :|
(although I hope @viktorklang likes my AtomicBoolean. ^^)