Skip to content

Commit

Permalink
Merge pull request #138 from input-output-hk/await-thread
Browse files Browse the repository at this point in the history
ensure spawned thread exits before main
  • Loading branch information
notgne2 authored Dec 5, 2021
2 parents 9a02de4 + 6295969 commit 715e92a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ pub async fn deploy_profile(
let (send_activate, recv_activate) = tokio::sync::oneshot::channel();
let (send_activated, recv_activated) = tokio::sync::oneshot::channel();

tokio::spawn(async move {
let thread = tokio::spawn(async move {
let o = ssh_activate.wait_with_output().await;

let maybe_err = match o {
Expand Down Expand Up @@ -399,6 +399,10 @@ pub async fn deploy_profile(
let c = confirm_profile(deploy_data, deploy_defs, temp_path, &ssh_addr).await;
recv_activated.await.unwrap();
c?;

thread
.await
.map_err(|x| DeployProfileError::SSHActivate(x.into()))?;
}

Ok(())
Expand Down

0 comments on commit 715e92a

Please sign in to comment.