Skip to content

Commit a7fe9cb

Browse files
committed
try strip different
1 parent b37817d commit a7fe9cb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

asyncgit/src/sync/hooks.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,20 @@ impl From<git2_hooks::HookResult> for HookResult {
1919
| git2_hooks::HookResult::NoHookFound => Self::Ok,
2020
git2_hooks::HookResult::RunNotSuccessful {
2121
stdout,
22-
mut stderr,
22+
stderr,
2323
..
2424
} => {
2525
const ANSI_CLEAR: &str = "\x1B[H\x1B[2J\x1B[3J";
2626

27-
if stderr == ANSI_CLEAR {
28-
stderr.clear();
27+
let mut combined = format!("{stdout}{stderr}");
28+
29+
if let Some(trimmed) =
30+
combined.strip_suffix(ANSI_CLEAR)
31+
{
32+
combined.truncate(trimmed.len());
2933
}
3034

31-
Self::NotOk(format!("{stdout}{stderr}"))
35+
Self::NotOk(combined)
3236
}
3337
}
3438
}

0 commit comments

Comments
 (0)