1. Stefan Saasen
  2. git

Commits

Junio C Hamano  committed de54d4f Merge

Merge branch 'sb/run-command-fd-error-reporting' into jch

Will merge to 'next'.

* sb/run-command-fd-error-reporting:
run-command: be more informative about what failed

  • Participants
  • Parent commits 6db8ea1, 939296c
  • Branches pu

Comments (0)

Files changed (1)

File run-command.c

View file
  • Ignore whitespace
 	int need_in, need_out, need_err;
 	int fdin[2], fdout[2], fderr[2];
 	int failed_errno = failed_errno;
+	char *str;
 
 	/*
 	 * In case of errors we must keep the promise to close FDs
 			failed_errno = errno;
 			if (cmd->out > 0)
 				close(cmd->out);
+			str = "standard input";
 			goto fail_pipe;
 		}
 		cmd->in = fdin[1];
 				close_pair(fdin);
 			else if (cmd->in)
 				close(cmd->in);
+			str = "standard output";
 			goto fail_pipe;
 		}
 		cmd->out = fdout[0];
 				close_pair(fdout);
 			else if (cmd->out)
 				close(cmd->out);
+			str = "standard error";
 fail_pipe:
-			error("cannot create pipe for %s: %s",
-				cmd->argv[0], strerror(failed_errno));
+			error("cannot create %s pipe for %s: %s",
+				str, cmd->argv[0], strerror(failed_errno));
 			errno = failed_errno;
 			return -1;
 		}