]> git.proxmox.com Git - proxmox-backup.git/commitdiff
mount: handle SIGTERM as well
authorStefan Reiter <s.reiter@proxmox.com>
Mon, 5 Oct 2020 08:57:57 +0000 (10:57 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 6 Oct 2020 07:08:14 +0000 (09:08 +0200)
instead of only SIGINT

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
src/bin/proxmox_backup_client/mount.rs

index 4f362dd2e5494f2d8c3633b712e3dd5e26b87e27..54bf848eae0669148d350e16e98f0af1042c0e95 100644 (file)
@@ -182,10 +182,14 @@ async fn mount_do(param: Value, pipe: Option<RawFd>) -> Result<Value, Error> {
             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
             }
         }