async fn exec_sync_output(
io: &Arc<ContainerIO>,
token: &CancellationToken,
exit_rx: Receiver<ExitChannelData>,
kill: impl FnOnce(),
) -> Result<ExecSyncOutput>Expand description
Read the output of an exec while waiting for its exit, and take the
result from the watcher alone. The watcher cancels the token once it
reaped the process or killed it at its timeout, the drain bounds the
reading after that. A deadline of the reading on its own would race the
one of the watcher, and report a timeout with the exit code of a process
which exited right at it, without its last output. A watcher which got
lost never cancels the token, nothing ends the process and its output
otherwise, like for a streaming exec, so it gets killed with kill.
Cancelling the token then stops the output, see
StopOutput.