Commit 800016b
committed
Fixes #115
We observed broken pipe output messages with bash_unit test in
some environments: github CI and nix builds. The tests are
passing but display this suspiscious error message.
@Pamplemousse has been able to reproduce them locally by trapping
SIGPIPE:
# trap '' SIGPIPE
# ./bash_unit -p test_fail_fails tests/test_core.sh
Running tests in tests/test_core.sh
Running test_fail_fails ... /nix/store/11b3chszacfr9liy829xqknzp3q88iji-gnugrep-3.11/bin/grep: write error: Broken pipe
SUCCESS ✓
Overall result: SUCCESS ✓
From man, SIGPIPE appears when a process writes on a pipe with
no reader. Looking at the problematic tests, we see that they
all rely on a muted bash_unit with a stacktrace output being
muted.
When we look at how the stacktrace is muted, the code was like this:
notify_stack () { : ; }
And when we look at how the stacktrace is outputed by bash_unit we
see the following code:
stacktrace | notify_stack
So we have some process run by stacktrace that is piped to a void
function, that is, no process on the right of this pipe is reading
which makes it a good candidate to generate a SIGPIPE.
By replacing the muted notify_stack with the following code, the
issue is solved:
notify_stack () { $CAT >/dev/null ; }1 parent a637d46 commit 800016b
2 files changed
+2
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
| 338 | + | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 30 | | |
36 | 31 | | |
37 | 32 | | |
| |||
0 commit comments