Skip to content

Commit be69068

Browse files
committed
process: make SIGPIPE an always failure
This error code does not exist on Windows, so any code that relied on this was broken (would fail this test) on that platform already. In most cases, it was actually a serious error too, such as `cp -v` or `tar -v`, which will indeed fail midway and give corrupt results if you do not read their output to completion!
1 parent 878e1cd commit be69068

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

base/process.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ function test_success(proc::Process)
476476
#TODO: this codepath is not currently tested
477477
throw(_UVError("could not start process " * repr(proc.cmd), proc.exitcode))
478478
end
479-
return proc.exitcode == 0 && (proc.termsignal == 0 || proc.termsignal == SIGPIPE)
479+
return proc.exitcode == 0 && proc.termsignal == 0
480480
end
481481

482482
function success(x::Process)

test/spawn.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ out = read(`$echocmd hello` & `$echocmd world`, String)
5555

5656
@test (run(`$printfcmd " \033[34m[stdio passthrough ok]\033[0m\n"`); true)
5757

58-
# Test for SIGPIPE being treated as normal termination (throws an error if broken)
59-
Sys.isunix() && run(pipeline(yescmd, `head`, devnull))
58+
# Test for SIGPIPE being a failure condition
59+
@test_throws ProcessFailedException run(pipeline(yescmd, `head`, devnull))
6060

6161
let p = run(pipeline(yescmd, devnull), wait=false)
6262
t = @async kill(p)

0 commit comments

Comments
 (0)