Skip to content

Commit 365fc4b

Browse files
committed
Merge branch 'pw/submodule-process-sigpipe' into seen
* pw/submodule-process-sigpipe: submodule status: propagate SIGPIPE
2 parents a777de4 + 082caf5 commit 365fc4b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

builtin/submodule--helper.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
700700

701701
if (flags & OPT_RECURSIVE) {
702702
struct child_process cpr = CHILD_PROCESS_INIT;
703+
int res;
703704

704705
cpr.git_cmd = 1;
705706
cpr.dir = path;
@@ -715,7 +716,10 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
715716
if (flags & OPT_QUIET)
716717
strvec_push(&cpr.args, "--quiet");
717718

718-
if (run_command(&cpr))
719+
res = run_command(&cpr);
720+
if (res == SIGPIPE + 128)
721+
raise(SIGPIPE);
722+
else if (res)
719723
die(_("failed to recurse into submodule '%s'"), path);
720724
}
721725

t/t7422-submodule-output.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,11 @@ do
167167
'
168168
done
169169

170+
test_expect_success !MINGW 'git submodule status --recursive propagates SIGPIPE' '
171+
{ git submodule status --recursive 2>err; echo $?>status; } |
172+
grep -q X/S &&
173+
test_must_be_empty err &&
174+
test_match_signal 13 "$(cat status)"
175+
'
176+
170177
test_done

0 commit comments

Comments
 (0)