tokio: adapt to 1.0 process:Child changes
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@proxmox.com>
This commit is contained in:
parent
5c852d5b82
commit
585e90c0de
@ -197,7 +197,7 @@ async fn termproxy(
|
|||||||
|
|
||||||
let mut needs_kill = false;
|
let mut needs_kill = false;
|
||||||
let res = tokio::select!{
|
let res = tokio::select!{
|
||||||
res = &mut child => {
|
res = child.wait() => {
|
||||||
let exit_code = res?;
|
let exit_code = res?;
|
||||||
if !exit_code.success() {
|
if !exit_code.success() {
|
||||||
match exit_code.code() {
|
match exit_code.code() {
|
||||||
@ -217,14 +217,13 @@ async fn termproxy(
|
|||||||
|
|
||||||
if needs_kill {
|
if needs_kill {
|
||||||
if res.is_ok() {
|
if res.is_ok() {
|
||||||
child.kill()?;
|
child.kill().await?;
|
||||||
child.await?;
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(err) = child.kill() {
|
if let Err(err) = child.kill().await {
|
||||||
worker.warn(format!("error killing termproxy: {}", err));
|
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));
|
worker.warn(format!("error awaiting termproxy: {}", err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user