Skip to content

Commit 5c9cfe3

Browse files
committed
fix(ghook): preserve downstream stdout on closed stdin
1 parent d5433bf commit 5c9cfe3

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

crates/ghook/src/statusline.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,10 @@ fn forward_downstream(command: &OsStr, stdin_raw: &[u8]) -> Option<Vec<u8>> {
137137
.spawn()
138138
.ok()?;
139139

140-
if let Some(mut stdin) = child.stdin.take()
141-
&& stdin.write_all(stdin_raw).is_err()
142-
{
143-
let _ = child.kill();
144-
let _ = child.wait();
145-
return None;
140+
if let Some(mut stdin) = child.stdin.take() {
141+
// Python's Popen.communicate(input=...) tolerates a downstream that
142+
// exits without reading stdin (e.g. `printf`). Still collect stdout.
143+
let _ = stdin.write_all(stdin_raw);
146144
}
147145

148146
let started = Instant::now();

0 commit comments

Comments
 (0)