diff --git a/src/modules/custom.rs b/src/modules/custom.rs index f731d9679..3385f6f40 100644 --- a/src/modules/custom.rs +++ b/src/modules/custom.rs @@ -161,6 +161,7 @@ fn shell_command(cmd: &str, shell_args: &[&str]) -> Option { .stderr(Stdio::piped()); handle_powershell(&mut command, &forced_shell, shell_args); + handle_cmd(&mut command, &forced_shell, shell_args); if let Ok(mut child) = command.spawn() { child.stdin.as_mut()?.write_all(cmd.as_bytes()).ok()?; @@ -247,6 +248,15 @@ fn handle_powershell(command: &mut Command, shell: &str, shell_args: &[&str]) { } } +#[cfg(windows)] +fn handle_cmd(command: &mut Command, shell: &str, shell_args: &[&str]) { + let is_cmd = shell.ends_with("cmd.exe") || shell.ends_with("cmd"); + + if is_cmd && shell_args.is_empty() { + command.arg("/C"); + } +} + #[cfg(test)] mod tests { use super::*;