fix(tui): handle bash on windows separately

This commit is contained in:
Paulo Aboim Pinto
2026-05-27 17:52:52 +02:00
committed by Hunter Bown
parent 4fb6a2268a
commit 8104c4789f
2 changed files with 14 additions and 14 deletions
+13 -13
View File
@@ -99,8 +99,10 @@ impl CommandSpec {
| crate::shell_dispatcher::ShellKind::WindowsPowerShell
) {
format!("[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; {command}")
} else {
} else if matches!(kind, crate::shell_dispatcher::ShellKind::Cmd) {
format!("chcp 65001 >NUL & {command}")
} else {
command.to_string()
};
dispatcher.build_command_parts(&cmd)
};
@@ -667,17 +669,15 @@ mod tests {
]
);
} else {
assert_eq!(
spec.args,
if cfg!(windows) {
vec!["/C".to_string(), format!("chcp 65001 >NUL & {cmd}")]
} else {
vec![
dispatcher.kind().command_flag().to_string(),
cmd.to_string(),
]
}
);
let expected = if matches!(dispatcher.kind(), crate::shell_dispatcher::ShellKind::Cmd) {
vec!["/C".to_string(), format!("chcp 65001 >NUL & {cmd}")]
} else {
vec![
dispatcher.kind().command_flag().to_string(),
cmd.to_string(),
]
};
assert_eq!(spec.args, expected);
// The quoted message is intact in a single argv slot — shell `-c`
// performs POSIX tokenization, yielding the correct argv:
// ["git","commit","-m","feat: complete sub-pages"].
@@ -754,7 +754,7 @@ mod tests {
.to_string(),
]
);
} else if cfg!(windows) {
} else if matches!(dispatcher.kind(), crate::shell_dispatcher::ShellKind::Cmd) {
assert_eq!(
env.command,
vec![
+1 -1
View File
@@ -936,7 +936,7 @@ fn issue_1691_quoted_commit_message_round_trips() {
format!("[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; {cmd}")
]
);
} else if cfg!(windows) {
} else if matches!(dispatcher.kind(), crate::shell_dispatcher::ShellKind::Cmd) {
assert_eq!(
spec.args,
["/C".to_string(), format!("chcp 65001 >NUL & {cmd}")]