mount: handle SIGTERM as well
instead of only SIGINT Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
38f5cb5b71
commit
1d0b662b42
|
@ -182,10 +182,14 @@ async fn mount_do(param: Value, pipe: Option<RawFd>) -> Result<Value, Error> {
|
||||||
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! {
|
select! {
|
||||||
res = session.fuse() => res?,
|
res = session.fuse() => res?,
|
||||||
_ = interrupt.recv().fuse() => {
|
_ = interrupt => {
|
||||||
// exit on interrupted
|
// exit on interrupted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue