From: Stefan Reiter <s.reiter@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v3 proxmox-backup 1/2] client: mount: handle SIGTERM as well
Date: Tue, 25 Aug 2020 13:46:24 +0200 [thread overview]
Message-ID: <20200825114625.26527-1-s.reiter@proxmox.com> (raw)
instead of only SIGINT
Signed-off-by: Stefan Reiter <s.reiter@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
next reply other threads:[~2020-08-25 11:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-25 11:46 Stefan Reiter [this message]
2020-08-25 11:46 ` [pbs-devel] [PATCH v3 proxmox-backup 2/2] client: implement map/unmap commands for .img backups Stefan Reiter
2020-10-01 15:36 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200825114625.26527-1-s.reiter@proxmox.com \
--to=s.reiter@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox