builtin/apply: move 'check_index' global into 'struct apply_state'
[gitweb.git] / run-command.c
index 8c7115ade496e5bbaf1b584199da8f3ab21fa087..e4593cd99b13fdbfec02939526ac151270aa20f5 100644 (file)
@@ -590,6 +590,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;