git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] notice error exit from pager

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 1, 2011, 20:17 UTC
Message-ID
<7vd3goj38n.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110801175921.GA17092@toss>
Clemens Buchacher <drizzd@aon.at> 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?

Show 35 quoted lines
> 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],
Previous: Clemens BuchacherNext: Clemens Buchacher
Message 6 of 7 in “notice error exit from pager”
  1. notice error exit from pagerClemens Buchacher, Jul 26, 2011
  2. Linus TorvaldsJul 26, 2011
  3. Johannes SixtJul 27, 2011
  4. error_routine: use parent's stderr if exec failsClemens Buchacher, Jul 27, 2011
  5. notice error exit from pagerClemens Buchacher, Aug 1, 2011
  6. Junio C HamanoAug 1, 2011
  7. Clemens BuchacherAug 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.