summary refs log tree commit diff
path: root/nix/libutil/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'nix/libutil/util.cc')
-rw-r--r--nix/libutil/util.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index ad3b3c387f..a4a1ddb12a 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -858,7 +858,8 @@ void killUser(uid_t uid)
 //////////////////////////////////////////////////////////////////////
 
 
-pid_t startProcess(std::function<void()> fun, const string & errorPrefix)
+pid_t startProcess(std::function<void()> fun,
+    bool dieWithParent, const string & errorPrefix, bool runExitHandlers)
 {
     pid_t pid = fork();
     if (pid == -1) throw SysError("unable to fork");
@@ -873,7 +874,10 @@ pid_t startProcess(std::function<void()> fun, const string & errorPrefix)
                 std::cerr << errorPrefix << e.what() << "\n";
             } catch (...) { }
         } catch (...) { }
-        _exit(1);
+        if (runExitHandlers)
+            exit(1);
+        else
+            _exit(1);
     }
 
     return pid;