bugfix: always generate a stack trace when spack is run with --debug (#11940)

- We weren't previously printing stack traces on SystemExit or
  KeyboardInterrupts.

- Either raise or print the stacktrace in these cases.
This commit is contained in:
Todd Gamblin
2019-07-05 19:57:00 -07:00
committed by GitHub
parent f21073d231
commit d2e5b8474a

View File

@@ -16,6 +16,7 @@
import inspect
import pstats
import argparse
import traceback
from six import StringIO
import llnl.util.tty as tty
@@ -705,10 +706,14 @@ def main(argv=None):
tty.die(e)
except KeyboardInterrupt:
if spack.config.get('config:debug'):
raise
sys.stderr.write('\n')
tty.die("Keyboard interrupt.")
except SystemExit as e:
if spack.config.get('config:debug'):
traceback.print_exc()
return e.code