Skip to main content

reader_gone_within

Function reader_gone_within 

Source
pub fn reader_gone_within(span: Duration) -> bool
Expand description

Wait for span, or until nobody reads stdout any more; true in that case.

For a command that prints on a timer (watch --json): the broken pipe is only noticed by a write, and the next one is a whole interval away, so a reader that left would be waited for that long. On Unix the wait itself watches the pipe and ends the moment the reader closes it. Windows has no such wait without more system calls than this is worth: there the reader’s leaving is noticed by the next write, as for any other command.