on master help sign in
Avoid setting stdin handle when not necessary (#3248)
3121353Dario Oddenino
helix-term/src/commands.rs+9−5
@@ -4552,14 +4552,18 @@ fn shell_impl(
4552 use std::process::{Command, Stdio};
4552 use std::process::{Command, Stdio};
4553 ensure!(!shell.is_empty(), "No shell set");
4553 ensure!(!shell.is_empty(), "No shell set");
4554
4554
4555− let mut process = match Command::new(&shell[0])
4555+ let mut process = Command::new(&shell[0]);
4556+ process
4556 .args(&shell[1..])
4557 .args(&shell[1..])
4557 .arg(cmd)
4558 .arg(cmd)
4558− .stdin(Stdio::piped())
4559 .stdout(Stdio::piped())
4559 .stdout(Stdio::piped())
4560− .stderr(Stdio::piped())
4560+ .stderr(Stdio::piped());
4561− .spawn()
4561+
4562− {
4562+ if input.is_some() {
4563+ process.stdin(Stdio::piped());
4564+ }
4565+
4566+ let mut process = match process.spawn() {
4563 Ok(process) => process,
4567 Ok(process) => process,
4564 Err(e) => {
4568 Err(e) => {
4565 log::error!("Failed to start shell: {}", e);
4569 log::error!("Failed to start shell: {}", e);