summary refs log tree commit diff
path: root/nix/libutil/util.cc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-05-11 17:04:26 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-11 17:04:26 +0200
commit766481d606e4b1860307692d6a44723983662d45 (patch)
tree7e6d112047bb03f7761ca8a41c02ac2a84b73c84 /nix/libutil/util.cc
parentc69944c511b89d3fdbffe00353e27d1e1c5f670c (diff)
parentfdee1ced43fb495d612a29e955141cdf6b9a95ba (diff)
downloadguix-766481d606e4b1860307692d6a44723983662d45.tar.gz
Merge commit 'fdee1ced43fb495d612a29e955141cdf6b9a95ba' into nix
Diffstat (limited to 'nix/libutil/util.cc')
-rw-r--r--nix/libutil/util.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index faa2b83c37..32244b2185 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -708,17 +708,14 @@ void AutoCloseDir::close()
 
 
 Pid::Pid()
+    : pid(-1), separatePG(false), killSignal(SIGKILL)
 {
-    pid = -1;
-    separatePG = false;
-    killSignal = SIGKILL;
 }
 
 
 Pid::Pid(pid_t pid)
+    : pid(pid), separatePG(false), killSignal(SIGKILL)
 {
-    Pid();
-    *this = pid;
 }
 
 
@@ -857,8 +854,10 @@ pid_t startProcess(std::function<void()> fun, const string & errorPrefix)
             restoreAffinity();
             fun();
         } catch (std::exception & e) {
-            writeToStderr(errorPrefix + string(e.what()) + "\n");
-        }
+            try {
+                std::cerr << errorPrefix << e.what() << "\n";
+            } catch (...) { }
+        } catch (...) { }
         _exit(1);
     }