summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2017-08-14 05:10:40 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2017-08-20 16:51:10 -0700
commit48440766dfd7ea381367f8d957372d262719c8e8 (patch)
tree2222ce6218853b07b6886ae238604a0cee1d1256 /lib
parent05cc6c966f4d340c42b89a74b63b1bd8fe22673d (diff)
downloadspack-48440766dfd7ea381367f8d957372d262719c8e8.tar.gz
spack-48440766dfd7ea381367f8d957372d262719c8e8.tar.bz2
spack-48440766dfd7ea381367f8d957372d262719c8e8.tar.xz
spack-48440766dfd7ea381367f8d957372d262719c8e8.zip
Fix exit call in `SpackError.die()`
- Previously we would use `os._exit()` in to avoid Spack error handling in the parent process when build processes failed. This isn't necessary anymore since build processes propagate their exceptions to the parent process. - Use `sys.exit` instead of `os._exit`. This has the advantage of automatically flushing output streams on quit, so output from child processes is not lost when Spack exits.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/error.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/spack/spack/error.py b/lib/spack/spack/error.py
index 7b86415202..6e48a4e76c 100644
--- a/lib/spack/spack/error.py
+++ b/lib/spack/spack/error.py
@@ -24,7 +24,6 @@
##############################################################################
from __future__ import print_function
-import os
import sys
import llnl.util.tty as tty
@@ -54,7 +53,8 @@ class SpackError(Exception):
# basic debug message
tty.error(self.message)
if self.long_message:
- print(self.long_message)
+ sys.stderr.write(self.long_message)
+ sys.stderr.write('\n')
# stack trace, etc. in debug mode.
if spack.debug:
@@ -66,7 +66,7 @@ class SpackError(Exception):
# run parent exception hook.
sys.excepthook(*sys.exc_info())
- os._exit(1)
+ sys.exit(1)
def __str__(self):
msg = self.message