aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/exec.cpp2
-rw-r--r--src/postfork.cpp3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/exec.cpp b/src/exec.cpp
index 63186ef7..bd9f9fb5 100644
--- a/src/exec.cpp
+++ b/src/exec.cpp
@@ -1181,7 +1181,7 @@ void exec_job(parser_t &parser, job_t *j)
const std::string outbuff = wcs2string(stdout_buffer);
const std::string errbuff = wcs2string(stderr_buffer);
bool builtin_io_done = do_builtin_io(outbuff.data(), outbuff.size(), errbuff.data(), errbuff.size());
- if (! builtin_io_done)
+ if (! builtin_io_done && errno != EPIPE)
{
show_stackframe();
}
diff --git a/src/postfork.cpp b/src/postfork.cpp
index 1eb958ad..29cf850c 100644
--- a/src/postfork.cpp
+++ b/src/postfork.cpp
@@ -569,12 +569,13 @@ bool do_builtin_io(const char *out, size_t outlen, const char *err, size_t errle
bool success = true;
if (out && outlen)
{
-
if (write_loop(STDOUT_FILENO, out, outlen) < 0)
{
+ int e = errno;
debug_safe(0, "Error while writing to stdout");
safe_perror("write_loop");
success = false;
+ errno = e;
}
}