From 0c99d9ddc3d00cb6a9f3f1ac962c822f7bf95933 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 25 Apr 2014 14:54:22 -0700 Subject: 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. --- lib/spack/spack/package.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3-60-g2f50