Skip to content

Commit ce17490

Browse files
committed
add more logging for diagnostics
1 parent f9b7db3 commit ce17490

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

git2-hooks/src/hookspath.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,23 @@ impl HookPaths {
183183
if let (Some(mut stdin_handle), Some(input)) =
184184
(child.stdin.take(), stdin)
185185
{
186-
use std::io::Write;
187-
// Ignore broken pipe errors - the hook may exit without reading stdin
188-
let _ = stdin_handle.write_all(input);
189-
drop(stdin_handle);
186+
use std::io::{ErrorKind, Write};
187+
188+
// Write stdin to hook process
189+
// Ignore broken pipe - hook may exit early without reading all input
190+
let _ =
191+
stdin_handle.write_all(input).inspect_err(|e| {
192+
match e.kind() {
193+
ErrorKind::BrokenPipe => {
194+
log::debug!(
195+
"Hook closed stdin early"
196+
);
197+
}
198+
_ => log::warn!(
199+
"Failed to write stdin to hook: {e}"
200+
),
201+
}
202+
});
190203
}
191204

192205
child.wait_with_output()

0 commit comments

Comments
 (0)