From 1d0b662b42c36786fbd016e9bd31737c59335648 Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Mon, 5 Oct 2020 10:57:57 +0200 Subject: [PATCH] mount: handle SIGTERM as well instead of only SIGINT Signed-off-by: Stefan Reiter --- src/bin/proxmox_backup_client/mount.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bin/proxmox_backup_client/mount.rs b/src/bin/proxmox_backup_client/mount.rs index 4f362dd2..54bf848e 100644 --- a/src/bin/proxmox_backup_client/mount.rs +++ b/src/bin/proxmox_backup_client/mount.rs @@ -182,10 +182,14 @@ async fn mount_do(param: Value, pipe: Option) -> Result { 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?, - _ = interrupt.recv().fuse() => { + _ = interrupt => { // exit on interrupted } }