diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2014-06-15 19:52:00 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2014-06-22 12:50:10 -0700 |
commit | 042a4730e345ac0ee58a43bfedd11a7d32efb490 (patch) | |
tree | da2ea51fe851d16c4bea8298b372cbfa7a99fce4 /lib | |
parent | 15f56ccee0b8002d7bdd7fec7d8f45eda49dcb2a (diff) | |
download | spack-042a4730e345ac0ee58a43bfedd11a7d32efb490.tar.gz spack-042a4730e345ac0ee58a43bfedd11a7d32efb490.tar.bz2 spack-042a4730e345ac0ee58a43bfedd11a7d32efb490.tar.xz spack-042a4730e345ac0ee58a43bfedd11a7d32efb490.zip |
Proper exiting for forked process in do_install()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/package.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 069c66f4a7..fff471599a 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -651,18 +651,18 @@ class Package(object): raise InstallError("Unable to fork build process: %s" % e) if pid == 0: - tty.msg("Building %s." % self.name) + try: + tty.msg("Building %s." % self.name) - # create the install directory (allow the layout to handle - # this in case it needs to add extra files) - spack.install_layout.make_path_for_spec(self.spec) + # create the install directory (allow the layout to handle + # this in case it needs to add extra files) + spack.install_layout.make_path_for_spec(self.spec) - # Set up process's build environment before running install. - build_env.set_compiler_environment_variables(self) - build_env.set_build_environment_variables(self) - build_env.set_module_variables_for_package(self) + # Set up process's build environment before running install. + build_env.set_compiler_environment_variables(self) + build_env.set_build_environment_variables(self) + build_env.set_module_variables_for_package(self) - try: # Subclasses implement install() to do the build & # install work. self.install(self.spec, self.prefix) @@ -693,7 +693,11 @@ class Package(object): "Spack will think this package is installed." + "Manually remove this directory to fix:", self.prefix) - raise + + # Child doesn't raise or return to main spack code. + # Just runs default exception handler and exits. + sys.excepthook(*sys.exc_info()) + os._exit(1) # Parent process just waits for the child to complete. If the # child exited badly, assume it already printed an appropriate @@ -727,7 +731,7 @@ class Package(object): force = kwargs.get('force', False) if not self.installed: - raise InstallError(self.spec + " is not installed.") + raise InstallError(str(self.spec) + " is not installed.") if not force: deps = self.installed_dependents |