Skip to content

Commit

Permalink
Merge pull request #24 from Danktronics/dependabot/cargo/dev/tokio-0.3
Browse files Browse the repository at this point in the history
Update tokio requirement from 0.2 to 0.3
  • Loading branch information
Sei4or authored Nov 7, 2020
2 parents 4f2443a + 6141d36 commit a559105
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ anyhow = "1.0"
regex = "1"
lazy_static = "1.4.0"
crossbeam-channel = "0.5"
tokio = { version = "0.2", features = ["process", "rt-threaded", "sync", "io-util"] }
tokio = { version = "0.3.3", features = ["process", "rt-multi-thread", "sync", "io-util"] }
futures = "0.3.4"
shell-words = "1.0.0"
chrono = "0.4"
9 changes: 5 additions & 4 deletions src/procedure_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ pub fn run_project_procedure(project: &Project, branch: &Branch, procedure: &Pro
let command = &commands[current_command_index];

info!(format!("[{}] [{}] Running command: {}", procedure_name, path, command));
let mut runtime = Builder::new().threaded_scheduler().enable_all().build().unwrap();
let result_child_process = runtime.handle().enter(|| run_procedure_command(&command, &path));
let runtime = Builder::new_multi_thread().enable_all().build().unwrap();
let _guard = runtime.enter();
let result_child_process = run_procedure_command(&command, &path);
if result_child_process.is_err() {
break;
}
Expand Down Expand Up @@ -90,7 +91,7 @@ pub fn run_project_procedure(project: &Project, branch: &Branch, procedure: &Pro
};

if !should_restart {
match child_process.kill() {
match runtime.block_on(child_process.kill()) {
Ok(()) => (),
Err(_e) => warn!(format!("[{}] Unable to kill child process. It may already be dead.", procedure_name))
};
Expand Down Expand Up @@ -146,7 +147,7 @@ async fn manage_child(child: &mut Child, connection: &ThreadProcedureConnection)
/// Bool indicates whether it exited successfully
/// i32 is status code
async fn complete_child(child: &mut Child) -> (bool, i32) {
let status_result: Result<ExitStatus, std::io::Error> = child.await; // Blocking
let status_result: Result<ExitStatus, std::io::Error> = child.wait().await;
if status_result.is_err() {
return (false, 1);
}
Expand Down

0 comments on commit a559105

Please sign in to comment.