@@ -4552,14 +4552,18 @@ fn shell_impl(
45524552 use std::process::{Command, Stdio};
45534553 ensure!(!shell.is_empty(), "No shell set");
45544554
4555− let mut process = match Command::new(&shell[0])
4555+ let mut process = Command::new(&shell[0]);
4556+ process
45564557 .args(&shell[1..])
45574558 .arg(cmd)
4558− .stdin(Stdio::piped())
45594559 .stdout(Stdio::piped())
4560− .stderr(Stdio::piped())
4561− .spawn()
4562− {
4560+ .stderr(Stdio::piped());
4561+
4562+ if input.is_some() {
4563+ process.stdin(Stdio::piped());
4564+ }
4565+
4566+ let mut process = match process.spawn() {
45634567 Ok(process) => process,
45644568 Err(e) => {
45654569 log::error!("Failed to start shell: {}", e);