about summary refs log tree commit diff
path: root/src/libmain/shared.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-31T08·31+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-31T08·31+0200
commit50dc1f5b71f7e0e4ba628904b9a47d9f9d875b3e (patch)
tree770054765d335695236e3c1c26f952a9aa76ff29 /src/libmain/shared.cc
parent45f9a91e186d91edbf2bed7d27b7fa7227730596 (diff)
Restore default SIGPIPE handler before invoking ‘man’
Fixes NixOS/nixpkgs#3410.
Diffstat (limited to 'src/libmain/shared.cc')
-rw-r--r--src/libmain/shared.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 14263446fe2e..47c38e33e67b 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -244,9 +244,9 @@ static void initAndRun(int argc, char * * argv)
 
 void showManPage(const string & name)
 {
-    string cmd = "man " + name;
-    if (system(cmd.c_str()) != 0)
-        throw Error(format("command `%1%' failed") % cmd);
+    restoreSIGPIPE();
+    execlp("man", "man", name.c_str(), NULL);
+    throw SysError(format("command `man %1%' failed") % name.c_str());
 }