]> git.ipfire.org Git - thirdparty/git.git/commit
submodule status: propagate SIGPIPE
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Fri, 20 Sep 2024 13:07:22 +0000 (13:07 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Sep 2024 20:07:03 +0000 (13:07 -0700)
commit082caf527ea769635e8c46d0cc181c844c50defd
tree9d4938262cdf7c9183ec168b7ecf9cd68453ed5e
parente29e5cf288141a51823bbd6d2da90105c42a10c1
submodule status: propagate SIGPIPE

It has been reported than running

     git submodule status --recurse | grep -q ^+

results in an unexpected error message

    fatal: failed to recurse into submodule $submodule

When "git submodule--helper" recurses into a submodule it creates a
child process. If that process fails then the error message above is
displayed by the parent. In the case above the child is killed by
SIGPIPE as "grep -q" exits as soon as it sees the first match. Fix this
by propagating SIGPIPE so that it is visible to the process running
git. We could propagate other signals but I'm not sure there is much
value in doing that. In the common case of the user pressing Ctrl-C or
Ctrl-\ then SIGINT or SIGQUIT will be sent to the foreground process
group and so the parent process will receive the same signal as the
child.

Reported-by: Matt Liberty <mliberty@precisioninno.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
t/t7422-submodule-output.sh