about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-23T17·11+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-23T17·11+0200
commitfdee1ced43fb495d612a29e955141cdf6b9a95ba (patch)
tree35dbc22fcfb65bb7d92a9c07bed5e138e21f1ca9
parent5989966ed3bd58cd362aed8cba6cd5c90b380a32 (diff)
startProcess: Make writing error messages from the child more robust
-rw-r--r--src/libutil/util.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 6df93f12a0c6..32244b2185b6 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -854,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);
     }