Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove usage of command groups #6992

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/turborepo-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ json_comments = "0.2.1"
jsonc-parser = { version = "0.21.0" }
lazy_static = { workspace = true }
libc = "0.2.140"
nix = "0.26.2"
notify = "5.1"
path-clean = "1.0.1"
petgraph = { workspace = true }
Expand Down
18 changes: 12 additions & 6 deletions crates/turborepo-lib/src/process/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
time::Duration,
};

use command_group::AsyncCommandGroup;
use itertools::Itertools;
pub use tokio::process::Command;
use tokio::{
Expand Down Expand Up @@ -84,7 +83,7 @@
/// channel when the child process exits.
async fn process(&self, child: &mut tokio::process::Child) -> ChildState {
match self {
ShutdownStyle::Graceful(timeout) => {

Check warning on line 86 in crates/turborepo-lib/src/process/child.rs

View workflow job for this annotation

GitHub Actions / Build Turborepo (windows, windows-latest)

unused variable: `timeout`

Check warning on line 86 in crates/turborepo-lib/src/process/child.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (windows-latest)

unused variable: `timeout`

Check warning on line 86 in crates/turborepo-lib/src/process/child.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (Go Fallback) (windows-latest)

unused variable: `timeout`
// try ro run the command for the given timeout
#[cfg(unix)]
{
Expand Down Expand Up @@ -147,7 +146,6 @@
#[derive(Clone, Debug)]
pub struct Child {
pid: Option<u32>,
gid: Option<u32>,
state: Arc<RwLock<ChildState>>,
exit_channel: watch::Receiver<Option<ChildExit>>,
stdin: Arc<Mutex<Option<tokio::process::ChildStdin>>>,
Expand Down Expand Up @@ -195,10 +193,19 @@
)
};

let group = command.group().spawn()?;
// Create a process group for the child on unix like systems
#[cfg(unix)]
{
use nix::unistd::setsid;
unsafe {
command.pre_exec(|| {
setsid()?;
Ok(())
});
}
}

let gid = group.id();
let mut child = group.into_inner();
let mut child = command.spawn()?;
let pid = child.id();

let stdin = child.stdin.take();
Expand Down Expand Up @@ -278,7 +285,6 @@

Ok(Self {
pid,
gid,
state,
exit_channel: exit_rx,
stdin: Arc::new(Mutex::new(stdin)),
Expand Down