aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--run-command.c10
-rw-r--r--run-command.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/run-command.c b/run-command.c
index 2392b1efe..11ac06049 100644
--- a/run-command.c
+++ b/run-command.c
@@ -588,6 +588,16 @@ static void *run_thread(void *data)
struct async *async = data;
intptr_t ret;
+ if (async->isolate_sigpipe) {
+ sigset_t mask;
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGPIPE);
+ if (pthread_sigmask(SIG_BLOCK, &mask, NULL) < 0) {
+ ret = error("unable to block SIGPIPE in async thread");
+ return (void *)ret;
+ }
+ }
+
pthread_setspecific(async_key, async);
ret = async->proc(async->proc_in, async->proc_out, async->data);
return (void *)ret;
diff --git a/run-command.h b/run-command.h
index c0969c769..a3043b16d 100644
--- a/run-command.h
+++ b/run-command.h
@@ -116,6 +116,7 @@ struct async {
int proc_in;
int proc_out;
#endif
+ int isolate_sigpipe;
};
int start_async(struct async *async);