mirror of
https://github.com/nushell/nushell.git
synced 2025-05-03 01:24:29 +02:00
add comment, make var more readable
This commit is contained in:
parent
009abfb8a8
commit
fbdb6e8ea0
@ -11,17 +11,18 @@ pub mod external_process_setup {
|
|||||||
libc::signal(libc::SIGTTIN, libc::SIG_IGN);
|
libc::signal(libc::SIGTTIN, libc::SIG_IGN);
|
||||||
|
|
||||||
external_command.pre_exec(|| {
|
external_command.pre_exec(|| {
|
||||||
|
// make the command startup with new process group.
|
||||||
|
// The process group id must be the same as external commands' pid.
|
||||||
|
// Or else we'll failed to set it as foreground process.
|
||||||
libc::setpgid(0, 0);
|
libc::setpgid(0, 0);
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_foreground(process: &std::process::Child) -> i32 {
|
pub fn set_foreground(process: &std::process::Child) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let my_id = libc::getpid();
|
libc::tcsetpgrp(libc::STDIN_FILENO, process.id() as i32);
|
||||||
libc::tcsetpgrp(0, process.id() as i32);
|
|
||||||
my_id
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user