@@ -276,12 +276,27 @@ pub mod provider {
276276 let stdin = input.map(|_| Stdio::piped()).unwrap_or_else(Stdio::null);
277277 let stdout = pipe_output.then(Stdio::piped).unwrap_or_else(Stdio::null);
278278
279− let mut child = Command::new(self.prg)
279+ let mut command: Command = Command::new(self.prg);
280+
281+ let mut command_mut: &mut Command = command
280282 .args(self.args)
281283 .stdin(stdin)
282284 .stdout(stdout)
283− .stderr(Stdio::null())
284− .spawn()?;
285+ .stderr(Stdio::null());
286+
287+ // Fix for https://github.com/helix-editor/helix/issues/5424
288+ if cfg!(unix) {
289+ use std::os::unix::process::CommandExt;
290+
291+ unsafe {
292+ command_mut = command_mut.pre_exec(|| match libc::setsid() {
293+ -1 => Err(std::io::Error::last_os_error()),
294+ _ => Ok(()),
295+ });
296+ }
297+ }
298+
299+ let mut child = command_mut.spawn()?;
285300
286301 if let Some(input) = input {
287302 let mut stdin = child.stdin.take().context("stdin is missing")?;