1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

Use setpgid from libc.

This commit is contained in:
Corey Farwell 2016-08-04 08:34:33 -04:00
parent 63c17e5b42
commit 160f7ed5f4

View file

@ -20,10 +20,6 @@ use std::io::{ErrorKind, Write};
use std::process::{Command, Stdio};
use uucore::process::ChildExt;
extern {
pub fn setpgid(_: libc::pid_t, _: libc::pid_t) -> libc::c_int;
}
static NAME: &'static str = "timeout";
static VERSION: &'static str = env!("CARGO_PKG_VERSION");
@ -96,7 +92,7 @@ Usage:
fn timeout(cmdname: &str, args: &[String], duration: f64, signal: usize, kill_after: f64, foreground: bool, preserve_status: bool) -> i32 {
if !foreground {
unsafe { setpgid(0, 0) };
unsafe { libc::setpgid(0, 0) };
}
let mut process = match Command::new(cmdname).args(args)
.stdin(Stdio::inherit())