public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH v4 proxmox-backup 1/2] mount: handle SIGTERM as well
@ 2020-10-05  8:57 Stefan Reiter
  2020-10-05  8:57 ` [pbs-devel] [PATCH v4 proxmox-backup 2/2] client: implement map/unmap commands for .img backups Stefan Reiter
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Reiter @ 2020-10-05  8:57 UTC (permalink / raw)
  To: pbs-devel

instead of only SIGINT

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

v4: rebase

 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<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
             }
         }
-- 
2.20.1





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-06  8:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05  8:57 [pbs-devel] [PATCH v4 proxmox-backup 1/2] mount: handle SIGTERM as well Stefan Reiter
2020-10-05  8:57 ` [pbs-devel] [PATCH v4 proxmox-backup 2/2] client: implement map/unmap commands for .img backups Stefan Reiter
2020-10-06  8:06   ` [pbs-devel] applied: " Dietmar Maurer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal