it used to be that if you throw
an error from main, then swift would print the error and exit with a non-zero status code that could be picked up by CI, etc.
Swift/ErrorType.swift:200: Fatal error: Error raised at top level: Some tests failed (1 of 3 test(s), 1 of 6 assertions(s))
Current stack trace:
0 libswiftCore.so 0x00007f5465507750 _swift_stdlib_reportFatalErrorInFile + 113
1 libswiftCore.so 0x00007f54651dd512 <unavailable> + 1459474
2 libswiftCore.so 0x00007f54651dd32c <unavailable> + 1458988
3 libswiftCore.so 0x00007f54651dc260 _assertionFailure(_:_:file:line:flags:) + 372
4 libswiftCore.so 0x00007f54652418c9 <unavailable> + 1870025
5 MarkdownPluginSwiftTests 0x00005584e5b032f7 <unavailable> + 1139447
6 libc.so.6 0x00007f546426e050 __libc_start_main + 234
7 MarkdownPluginSwiftTests 0x00005584e5a8c0fa <unavailable> + 651514
but now it doesn’t exit, it just transitions to some kind of interactive debugging console:
💣 Program crashed: Illegal instruction at 0x00007f2bf9e673e0
Thread 0 "MarkdownPluginS" crashed:
0 0x00007f2bf9e673e0 _assertionFailure(_:_:file:line:flags:) + 384 in libswiftCore.so
Press space to interact, D to debug, or any other key to quit (26s)
this is really annoying and not at all helpful! not only does it affect the swift run
command, it is apparently enabled even if you run the compiled binaries directly.
99% of the time when an error gets thrown from main, it is because the program failed (invalid input, resource does not exist, etc. etc.) and you do not want to start a debugging session.
is there a way to opt out of this behavior?