diff options
author | Clemens Buchacher <drizzd@aon.at> | 2011-08-01 19:59:21 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-01 16:21:55 -0700 |
commit | fc1b56f054a79400c4e72cb1aab97ba2605cbd83 (patch) | |
tree | 846a6523cb2d59642633cb163b9472c90f16d98c /pack-refs.h | |
parent | 3bc4181fde899e02aff89f7c0a47f18d37311cb3 (diff) | |
download | git-fc1b56f054a79400c4e72cb1aab97ba2605cbd83.tar.gz git-fc1b56f054a79400c4e72cb1aab97ba2605cbd83.tar.xz |
notice error exit from pager
If the pager fails to run, git produces no output, e.g.:
$ GIT_PAGER=not-a-command git log
The error reporting fails for two reasons:
(1) start_command: There is a mechanism that detects errors during
execvp introduced in 2b541bf8 (start_command: detect execvp
failures early). The child writes one byte to a pipe only if
execvp fails. The parent waits for either EOF, when the
successful execvp automatically closes the pipe (see
FD_CLOEXEC in fcntl(1)), or it reads a single byte, in which
case it knows that the execvp failed. This mechanism is
incompatible with the workaround introduced in 35ce8622
(pager: Work around window resizing bug in 'less'), which
waits for input from the parent before the exec. Since both
the parent and the child are waiting for input from each
other, that would result in a deadlock. In order to avoid
that, the mechanism is disabled by closing the child_notifier
file descriptor.
(2) finish_command: The parent correctly detects the 127 exit
status from the child, but the error output goes nowhere,
since by that time it is already being redirected to the
child.
No simple solution for (1) comes to mind.
Number (2) can be solved by not sending error output to the pager.
Not redirecting error output to the pager can result in the pager
overwriting error output with standard output, however.
Since there is no reliable way to handle error reporting in the
parent, produce the output in the child instead.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-refs.h')
0 files changed, 0 insertions, 0 deletions