Reputation: 21965
Could somebody explain how the timeout
works for piped commands? For example,
timeout 2s a | b
Here is the timeout
applied only for the a
command?
And if timeout indeed occurs, would that result in a broken pipe?
Upvotes: 0
Views: 146
Reputation: 753695
Yes, timeout
is a regular command, not a built-in, so it is executed with arguments timeout
, 2s
and a
. If the timeout occurs, the read end of the pipe in b
will indicate EOF once all the data in it has been read (because there's no process left to write to the pipe). But b
will not get a SIGPIPE signal from a
exiting (whether because of a timeout or because it finished before the timeout); a broken pipe is a problem on the write side, not the read side.
Upvotes: 1