Rust · 1007 bytes Raw Blame History
1 // Rush job - Job control implementation
2 //
3 // This module provides job control functionality including:
4 // - Process group management
5 // - Background/foreground job execution
6 // - Job suspension and continuation
7 // - Signal handling (SIGCHLD, SIGTSTP, SIGINT)
8
9 #![cfg(unix)]
10
11 pub mod job;
12 pub mod signals;
13 pub mod terminal;
14
15 pub use job::{Job, JobId, JobList, JobState};
16 pub use signals::{check_children, check_sighup, check_sigwinch, setup_job_control_signals};
17 pub use terminal::{
18 give_terminal_to, get_terminal_attrs, restore_shell_terminal, restore_terminal_attrs,
19 save_terminal_attrs, set_terminal_attrs, setup_shell_terminal,
20 };
21
22 use thiserror::Error;
23
24 #[derive(Error, Debug)]
25 pub enum JobError {
26 #[error("Job not found: {0}")]
27 JobNotFound(String),
28
29 #[error("No current job")]
30 NoCurrentJob,
31
32 #[error("Job is not stopped")]
33 JobNotStopped,
34
35 #[error("System error: {0}")]
36 SystemError(#[from] nix::Error),
37 }
38
39 pub type Result<T> = std::result::Result<T, JobError>;
40