Fix SPACK-17: Remove install prefix if install() fails
- except clause now catches anything, not just exception - sys.exit() changed to os._exit() to avoid interfering with unit tests and to avoid raising SystemExit exception when child processes quit.
This commit is contained in:
parent
15589754ec
commit
0c99d9ddc3
1 changed files with 6 additions and 3 deletions
|
@ -674,15 +674,18 @@ def do_install(self):
|
|||
% self.name)
|
||||
|
||||
# On successful install, remove the stage.
|
||||
# Leave if if there is an error
|
||||
# Leave if there is an error
|
||||
self.stage.destroy()
|
||||
|
||||
tty.msg("Successfully installed %s" % self.name)
|
||||
print_pkg(self.prefix)
|
||||
|
||||
sys.exit(0)
|
||||
# Use os._exit here to avoid raising a SystemExit exception,
|
||||
# which interferes with unit tests.
|
||||
os._exit(0)
|
||||
|
||||
except Exception, e:
|
||||
except:
|
||||
# If anything else goes wrong, get rid of the install dir.
|
||||
self.remove_prefix()
|
||||
raise
|
||||
|
||||
|
|
Loading…
Reference in a new issue