Don't terminate when make's output is redirected to a pipe and the
reader exits early; e.g.:
$ echo 'all:; sleep 2' | make -f- -j2 -O |:
This lets us unlink temporary files, and tell the user that make was
not able to write its output.
Reported by Frank Heckenbach <f.heckenbach@fh-soft.de>.
* src/main.c (main): Ignore SIGPIPE.
* src/posixos.c (osync_clear): Fix a memory leak.
/* Useful for attaching debuggers, etc. */
SPIN ("main-entry");
+ /* Don't die if our stdout sends us SIGPIPE. */
+#ifdef SIGPIPE
+ bsd_signal (SIGPIPE, SIG_IGN);
+#endif
+
#ifdef HAVE_ATEXIT
if (ANY_SET (check_io_state (), IO_STDOUT_OK))
atexit (close_stdout);
int r;
EINTRLOOP (r, unlink (osync_tmpfile));
+ free (osync_tmpfile);
osync_tmpfile = NULL;
}
}