|
|
@ -276,12 +276,27 @@ pub mod provider {
|
|
|
|
let stdin = input.map(|_| Stdio::piped()).unwrap_or_else(Stdio::null);
|
|
|
|
let stdin = input.map(|_| Stdio::piped()).unwrap_or_else(Stdio::null);
|
|
|
|
let stdout = pipe_output.then(Stdio::piped).unwrap_or_else(Stdio::null);
|
|
|
|
let stdout = pipe_output.then(Stdio::piped).unwrap_or_else(Stdio::null);
|
|
|
|
|
|
|
|
|
|
|
|
let mut child = Command::new(self.prg)
|
|
|
|
let mut command: Command = Command::new(self.prg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut command_mut: &mut Command = command
|
|
|
|
.args(self.args)
|
|
|
|
.args(self.args)
|
|
|
|
.stdin(stdin)
|
|
|
|
.stdin(stdin)
|
|
|
|
.stdout(stdout)
|
|
|
|
.stdout(stdout)
|
|
|
|
.stderr(Stdio::null())
|
|
|
|
.stderr(Stdio::null());
|
|
|
|
.spawn()?;
|
|
|
|
|
|
|
|
|
|
|
|
// Fix for https://github.com/helix-editor/helix/issues/5424
|
|
|
|
|
|
|
|
if cfg!(unix) {
|
|
|
|
|
|
|
|
use std::os::unix::process::CommandExt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
|
|
|
|
command_mut = command_mut.pre_exec(|| match libc::setsid() {
|
|
|
|
|
|
|
|
-1 => Err(std::io::Error::last_os_error()),
|
|
|
|
|
|
|
|
_ => Ok(()),
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut child = command_mut.spawn()?;
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(input) = input {
|
|
|
|
if let Some(input) = input {
|
|
|
|
let mut stdin = child.stdin.take().context("stdin is missing")?;
|
|
|
|
let mut stdin = child.stdin.take().context("stdin is missing")?;
|
|
|
|