grep: fix grepping for "intent to add" files
[gitweb.git] / run-command.c
index 65ecbe31d7a61b20f42fd40eaf72d422c0c57a99..aad03ab705f301268980079282fcf370b9275c5a 100644 (file)
@@ -4,10 +4,6 @@
 #include "sigchain.h"
 #include "argv-array.h"
 
-#ifndef SHELL_PATH
-# define SHELL_PATH "/bin/sh"
-#endif
-
 void child_process_init(struct child_process *child)
 {
        memset(child, 0, sizeof(*child));
@@ -561,7 +557,12 @@ int finish_command(struct child_process *cmd)
 
 int run_command(struct child_process *cmd)
 {
-       int code = start_command(cmd);
+       int code;
+
+       if (cmd->out < 0 || cmd->err < 0)
+               die("BUG: run_command with a pipe can cause deadlock");
+
+       code = start_command(cmd);
        if (code)
                return code;
        return finish_command(cmd);