Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submodule status: propagate SIGPIPE #1799

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion builtin/submodule--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,

if (flags & OPT_RECURSIVE) {
struct child_process cpr = CHILD_PROCESS_INIT;
int res;

cpr.git_cmd = 1;
cpr.dir = path;
Expand All @@ -710,7 +711,10 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
if (flags & OPT_QUIET)
strvec_push(&cpr.args, "--quiet");

if (run_command(&cpr))
res = run_command(&cpr);
if (res == SIGPIPE + 128)
raise(SIGPIPE);
else if (res)
die(_("failed to recurse into submodule '%s'"), path);
}

Expand Down
7 changes: 7 additions & 0 deletions t/t7422-submodule-output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,11 @@ do
'
done

test_expect_success !MINGW 'git submodule status --recursive propagates SIGPIPE' '
{ git submodule status --recursive 2>err; echo $?>status; } |
grep -q X/S &&
test_must_be_empty err &&
test_match_signal 13 "$(cat status)"
'

test_done
Loading