Re: [PATCH] notice error exit from pager

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] notice error exit from pager

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:51:43

Clemens Buchacher [off-list ref] writes:
Since there is no reliable way to handle error reporting in the
parent, produce the output in the child instead.
Hmm, how does this interact with your earlier "error_routine: use parent's
stderr if exec fails" patch?
quoted hunk
diff --git a/run-command.c b/run-command.c
index 5c91f37..a2796c4 100644
--- a/run-command.c
+++ b/run-command.c
@@ -125,9 +125,6 @@ static int wait_or_whine(pid_t pid, const char *argv0, int silent_exec_failure)
 		if (code == 127) {
 			code = -1;
 			failed_errno = ENOENT;
-			if (!silent_exec_failure)
-				error("cannot run %s: %s", argv0,
-					strerror(ENOENT));
 		}
 	} else {
 		error("waitpid is confused (%s)", argv0);
@@ -282,14 +279,14 @@ fail_pipe:
 		} else {
 			execvp(cmd->argv[0], (char *const*) cmd->argv);
 		}
-		/*
-		 * Do not check for cmd->silent_exec_failure; the parent
-		 * process will check it when it sees this exit code.
-		 */
-		if (errno == ENOENT)
+		if (errno == ENOENT) {
+			if (!cmd->silent_exec_failure)
+				error("cannot run %s: %s", cmd->argv[0],
+					strerror(ENOENT));
 			exit(127);
-		else
+		} else {
 			die_errno("cannot exec '%s'", cmd->argv[0]);
+		}
 	}
 	if (cmd->pid < 0)
 		error("cannot fork() for %s: %s", cmd->argv[0],

Re: [PATCH] notice error exit from pager

From: Clemens Buchacher <hidden>
Date: 2016-06-15 22:51:43

On Mon, Aug 01, 2011 at 01:17:28PM -0700, Junio C Hamano wrote:
Clemens Buchacher [off-list ref] writes:
quoted
Since there is no reliable way to handle error reporting in the
parent, produce the output in the child instead.
Hmm, how does this interact with your earlier "error_routine: use parent's
stderr if exec fails" patch?
The use case addressed in this patch (i.e., the pager) does not
strictly dependent on the previous patch. But Johannes noted that
in general, error output of the child could be redirected, hiding
the execve failure again. The error_routine patch avoids that by
writing to the parent's stderr stream.

Clemens
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help