Skip to content

Commit

Permalink
Use CommandGroup to let OS kill spawned processes
Browse files Browse the repository at this point in the history
  • Loading branch information
LPGhatguy committed Jan 7, 2022
1 parent 26ca90f commit 1842a95
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
41 changes: 37 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository = "https://github.com/LPGhatguy/aftman"
[dependencies]
anyhow = "1.0.43"
atty = "0.2.14"
command-group = "1.0.8"
dialoguer = "0.9.0"
dirs = "3.0.2"
env_logger = "0.9.0"
Expand Down
3 changes: 2 additions & 1 deletion src/tool_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::path::{Path, PathBuf};
use std::process::Command;

use anyhow::{bail, Context};
use command_group::CommandGroup;
use fs_err::File;
use once_cell::unsync::OnceCell;

Expand Down Expand Up @@ -56,7 +57,7 @@ impl ToolStorage {
self.install_exact(id)?;

let exe_path = self.exe_path(id);
let status = Command::new(exe_path).args(args).status().unwrap();
let status = Command::new(exe_path).args(args).group_status().unwrap();

Ok(status.code().unwrap_or(1))
}
Expand Down

0 comments on commit 1842a95

Please sign in to comment.