merge PR #5671 via eval/pr-5671: fix(bash): drained piped output before timeout return

This commit is contained in:
can1357
2026-07-17 04:37:11 +02:00
6 changed files with 85 additions and 5 deletions
+5
View File
@@ -1141,11 +1141,16 @@ async fn run_shell_command_once(
}
}
});
// Let pipeline consumers flush output after cancellation kills their
// producers. The outer run cancellation remains bounded, and this delayed
// fallback still releases readers whose writers never close.
const CANCEL_READER_GRACE: Duration = Duration::from_millis(500);
let cancel_bridge = tokio::spawn({
let cancel_token = cancel_token.clone();
let reader_cancel = reader_cancel.clone();
async move {
cancel_token.cancelled().await;
time::sleep(CANCEL_READER_GRACE).await;
reader_cancel.cancel();
}
});