Skip to content

Commit caf83c8

Browse files
committed
weird hack only on windows
1 parent d25efdc commit caf83c8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

asyncgit/src/sync/hooks.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ impl From<git2_hooks::HookResult> for HookResult {
2222
stderr,
2323
..
2424
} => {
25-
const ANSI_CLEAR: &str = "\x1B[H\x1B[2J\x1B[3J";
26-
2725
let mut combined = format!("{stdout}{stderr}");
2826

29-
if let Some(trimmed) =
30-
combined.strip_suffix(ANSI_CLEAR)
31-
{
32-
combined.truncate(trimmed.len());
27+
if cfg!(windows) {
28+
const ANSI_CLEAR: &str = "\x1B[H\x1B[2J\x1B[3J";
29+
30+
if let Some(trimmed) =
31+
combined.strip_suffix(ANSI_CLEAR)
32+
{
33+
combined.truncate(trimmed.len());
34+
}
3335
}
3436

3537
Self::NotOk(combined)

0 commit comments

Comments
 (0)