re-imported job/signal code from old implementation
This commit is contained in:
18
src/libsh/sys.rs
Normal file
18
src/libsh/sys.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use crate::{prelude::*, state::write_jobs};
|
||||
|
||||
pub fn sh_quit(code: i32) -> ! {
|
||||
write_jobs(|j| {
|
||||
for job in j.jobs_mut().iter_mut().flatten() {
|
||||
job.killpg(Signal::SIGTERM).ok();
|
||||
}
|
||||
});
|
||||
if let Some(termios) = crate::get_saved_termios() {
|
||||
termios::tcsetattr(std::io::stdin(), termios::SetArg::TCSANOW, &termios).unwrap();
|
||||
}
|
||||
if code == 0 {
|
||||
eprintln!("exit");
|
||||
} else {
|
||||
eprintln!("exit {code}");
|
||||
}
|
||||
exit(code);
|
||||
}
|
||||
Reference in New Issue
Block a user