1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-25 14:05:41 -05:00

Fix zombie children (#976)

Resolves #973
This commit is contained in:
Joe Wilm 2017-12-29 09:19:14 -08:00 committed by GitHub
parent 2879830f1d
commit 8ce553f28a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,7 @@ use std::borrow::Cow;
use std::mem;
use std::process::Command;
use std::time::Instant;
use std::os::unix::process::CommandExt;
use copypasta::{Clipboard, Load, Buffer};
use glutin::{ElementState, VirtualKeyCode, MouseButton, TouchPhase, MouseScrollDelta};
@ -200,7 +201,16 @@ impl Action {
},
Action::Command(ref program, ref args) => {
trace!("running command: {} {:?}", program, args);
match Command::new(program).args(args).spawn() {
match Command::new(program)
.args(args)
.before_exec(|| {
// Detach forked process from Alacritty. This will cause
// init or whatever to clean up child processes for us.
unsafe { ::libc::daemon(1, 0); }
Ok(())
})
.spawn()
{
Ok(child) => {
debug!("spawned new proc with pid: {}", child.id());
},