[pbs-devel] [PATCH proxmox-backup 06/12] tokio: adapt to 1.0 process:Child changes

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jan 12 14:58:20 CET 2021


Child itself is no longer a Future, but it has a new wait() async fn
that does the same thing

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/api2/node.rs | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/api2/node.rs b/src/api2/node.rs
index b1a25e0e..51dfdd19 100644
--- a/src/api2/node.rs
+++ b/src/api2/node.rs
@@ -197,7 +197,7 @@ async fn termproxy(
 
             let mut needs_kill = false;
             let res = tokio::select!{
-                res = &mut child => {
+                res = child.wait() => {
                     let exit_code = res?;
                     if !exit_code.success() {
                         match exit_code.code() {
@@ -217,14 +217,13 @@ async fn termproxy(
 
             if needs_kill {
                 if res.is_ok() {
-                    child.kill()?;
-                    child.await?;
+                    child.kill().await?;
                     return Ok(());
                 }
 
-                if let Err(err) = child.kill() {
+                if let Err(err) = child.kill().await {
                     worker.warn(format!("error killing termproxy: {}", err));
-                } else if let Err(err) = child.await {
+                } else if let Err(err) = child.wait().await {
                     worker.warn(format!("error awaiting termproxy: {}", err));
                 }
             }
-- 
2.20.1






More information about the pbs-devel mailing list