instead of only SIGINT
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
nix::unistd::close(pipe).unwrap();
}
nix::unistd::close(pipe).unwrap();
}
- let mut interrupt = signal(SignalKind::interrupt())?;
+ // handle SIGINT and SIGTERM
+ let mut interrupt_int = signal(SignalKind::interrupt())?;
+ let mut interrupt_term = signal(SignalKind::terminate())?;
+ let mut interrupt = futures::future::select(interrupt_int.next(), interrupt_term.next());
+
select! {
res = session.fuse() => res?,
select! {
res = session.fuse() => res?,
- _ = interrupt.recv().fuse() => {
// exit on interrupted
}
}
// exit on interrupted
}
}