Merge branch 'jk/push-client-deadlock-fix' into HEAD
[gitweb.git] / run-command.c
index 863dad52f1913d8fa20fccd23fc527580c6fcaf7..2d6628012d7f3dc555d9bf385e990ac2c4ec6885 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;
@@ -902,35 +912,18 @@ struct parallel_processes {
        struct strbuf buffered_output; /* of finished children */
 };
 
-static int default_start_failure(struct child_process *cp,
-                                struct strbuf *err,
+static int default_start_failure(struct strbuf *err,
                                 void *pp_cb,
                                 void *pp_task_cb)
 {
-       int i;
-
-       strbuf_addstr(err, "Starting a child failed:");
-       for (i = 0; cp->argv[i]; i++)
-               strbuf_addf(err, " %s", cp->argv[i]);
-
        return 0;
 }
 
 static int default_task_finished(int result,
-                                struct child_process *cp,
                                 struct strbuf *err,
                                 void *pp_cb,
                                 void *pp_task_cb)
 {
-       int i;
-
-       if (!result)
-               return 0;
-
-       strbuf_addf(err, "A child failed with return code %d:", result);
-       for (i = 0; cp->argv[i]; i++)
-               strbuf_addf(err, " %s", cp->argv[i]);
-
        return 0;
 }
 
@@ -1048,8 +1041,7 @@ static int pp_start_one(struct parallel_processes *pp)
        pp->children[i].process.no_stdin = 1;
 
        if (start_command(&pp->children[i].process)) {
-               code = pp->start_failure(&pp->children[i].process,
-                                        &pp->children[i].err,
+               code = pp->start_failure(&pp->children[i].err,
                                         pp->data,
                                         &pp->children[i].data);
                strbuf_addbuf(&pp->buffered_output, &pp->children[i].err);
@@ -1117,7 +1109,7 @@ static int pp_collect_finished(struct parallel_processes *pp)
 
                code = finish_command(&pp->children[i].process);
 
-               code = pp->task_finished(code, &pp->children[i].process,
+               code = pp->task_finished(code,
                                         &pp->children[i].err, pp->data,
                                         &pp->children[i].data);