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