From 044e2e1c1460fb060f677a366144b98905522754 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 31 Jan 2017 22:08:38 +0300 Subject: Add sed builtin --- build2/b.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'build2/b.cxx') 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 // strerror() +#ifndef _WIN32 +# include // signal() +#endif + #include // getenv() _putenv()(_WIN32) #include @@ -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). -- cgit v1.1