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.
This commit is contained in:
parent
05cc6c966f
commit
48440766df
@ -24,7 +24,6 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
@ -54,7 +53,8 @@ def die(self):
|
|||||||
# basic debug message
|
# basic debug message
|
||||||
tty.error(self.message)
|
tty.error(self.message)
|
||||||
if self.long_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.
|
# stack trace, etc. in debug mode.
|
||||||
if spack.debug:
|
if spack.debug:
|
||||||
@ -66,7 +66,7 @@ def die(self):
|
|||||||
# run parent exception hook.
|
# run parent exception hook.
|
||||||
sys.excepthook(*sys.exc_info())
|
sys.excepthook(*sys.exc_info())
|
||||||
|
|
||||||
os._exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
msg = self.message
|
msg = self.message
|
||||||
|
Loading…
Reference in New Issue
Block a user