diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-31 22:08:38 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-02-03 23:57:27 +0300 |
commit | 044e2e1c1460fb060f677a366144b98905522754 (patch) | |
tree | 4cdd67e9bca323d74cf5cc514444019a70b4de95 /build2/b.cxx | |
parent | 31a4169c67045cfe37eed138b537930e259db1e9 (diff) |
Add sed builtin
Diffstat (limited to 'build2/b.cxx')
-rw-r--r-- | build2/b.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/build2/b.cxx b/build2/b.cxx index e576435..b06459b 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -2,7 +2,10 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include <string.h> // strerror() +#ifndef _WIN32 +# include <signal.h> // signal() +#endif + #include <stdlib.h> // getenv() _putenv()(_WIN32) #include <sstream> @@ -82,6 +85,17 @@ main (int argc, char* argv[]) { tracer trace ("main"); + // On POSIX ignore SIGPIPE which is signaled to a pipe-writing process if + // the pipe reading end is closed. Note that by default this signal + // terminates a process. Also note that there is no way to disable this + // behavior on a file descriptor basis or for the write() function call. + // +#ifndef _WIN32 + if (signal (SIGPIPE, SIG_IGN) == SIG_ERR) + fail << "unable to ignore broken pipe (SIGPIPE) signal: " + << system_error (errno, system_category ()); // Sanitize. +#endif + // Parse the command line. We want to be able to specify options, vars, // and buildspecs in any order (it is really handy to just add -v at the // end of the command line). |