summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-04-25 14:54:22 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-04-25 14:55:50 -0700
commit0c99d9ddc3d00cb6a9f3f1ac962c822f7bf95933 (patch)
treeade1583391646327dfda77d10fc16effcba3c6af /lib
parent15589754ecfee76ae6972eeebfe5d888172e5b9b (diff)
downloadspack-0c99d9ddc3d00cb6a9f3f1ac962c822f7bf95933.tar.gz
spack-0c99d9ddc3d00cb6a9f3f1ac962c822f7bf95933.tar.bz2
spack-0c99d9ddc3d00cb6a9f3f1ac962c822f7bf95933.tar.xz
spack-0c99d9ddc3d00cb6a9f3f1ac962c822f7bf95933.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 6d1ca64639..d0c5b22211 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -674,15 +674,18 @@ class Package(object):
% 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