[pbs-devel] [PATCH v3 proxmox-backup 1/2] client: mount: handle SIGTERM as well
Stefan Reiter
s.reiter at proxmox.com
Tue Aug 25 13:46:24 CEST 2020
instead of only SIGINT
Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
new in v3
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 7646e98c..7ac25f4e 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
More information about the pbs-devel
mailing list