run-command: forbid using run_command with piped output
[gitweb.git] / run-command.c
index 65ecbe31d7a61b20f42fd40eaf72d422c0c57a99..4184e8d9f3a61459df1d4fa4cdec8a59386f1f17 100644 (file)
@@ -561,7 +561,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);