This commit is contained in:
Daniel Flanagan 2024-04-17 17:04:46 -05:00
parent ac8ba06f4c
commit 1607a223cc

View file

@ -19,6 +19,21 @@ pub struct Tui {
tasks: SharedTasks, tasks: SharedTasks,
} }
async fn handle_signals(mut signals: Signals, channel: ) {
while let Some(signal) = signals.next().await {
match signal {
SIGHUP => {
// Reload configuration
// Reopen the log file
}
SIGTERM | SIGINT | SIGQUIT => {
// Shutdown the system;
},
_ => unreachable!(),
}
}
}
impl Tui { impl Tui {
pub fn new(tasks: SharedTasks) -> Self { pub fn new(tasks: SharedTasks) -> Self {
Self { tasks } Self { tasks }
@ -36,6 +51,8 @@ impl Tui {
let mut signals = Signals::new(&[SIGHUP, SIGTERM, SIGINT, SIGQUIT])?; let mut signals = Signals::new(&[SIGHUP, SIGTERM, SIGINT, SIGQUIT])?;
let handle = signals.handle(); let handle = signals.handle();
// TODO: enable isig to re-allow ctrl-z?
loop { loop {
terminal.draw(|frame| { terminal.draw(|frame| {
let area = frame.size(); let area = frame.size();