Proper exiting for forked process in do_install()

This commit is contained in:
Todd Gamblin 2014-06-15 19:52:00 -07:00
parent 15f56ccee0
commit 042a4730e3

View file

@ -651,6 +651,7 @@ def do_install(self, **kwargs):
raise InstallError("Unable to fork build process: %s" % e)
if pid == 0:
try:
tty.msg("Building %s." % self.name)
# create the install directory (allow the layout to handle
@ -662,7 +663,6 @@ def do_install(self, **kwargs):
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 @@ def do_install(self, **kwargs):
"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 @@ def do_uninstall(self, **kwargs):
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