Skip to content

Commit 5a509cc

Browse files
committed
Auto merge of #17278 - chenx97:flycheck-process-wrap, r=lnicola
internal: replace command-group with process-wrap Because command-group no longer receives updates and depends on an older version of nix.
2 parents d6d735e + 3c6c5cd commit 5a509cc

File tree

4 files changed

+73
-45
lines changed

4 files changed

+73
-45
lines changed

Cargo.lock

Lines changed: 60 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ chalk-solve = { version = "0.97.0", default-features = false }
111111
chalk-ir = "0.97.0"
112112
chalk-recursive = { version = "0.97.0", default-features = false }
113113
chalk-derive = "0.97.0"
114-
command-group = "2.0.1"
115114
crossbeam-channel = "0.5.8"
116115
dissimilar = "1.0.7"
117116
dot = "0.1.4"
@@ -132,6 +131,7 @@ object = { version = "0.33.0", default-features = false, features = [
132131
"macho",
133132
"pe",
134133
] }
134+
process-wrap = { version = "8.0.2", features = ["std"] }
135135
pulldown-cmark-to-cmark = "10.0.4"
136136
pulldown-cmark = { version = "0.9.0", default-features = false }
137137
rayon = "1.8.0"

crates/flycheck/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ tracing.workspace = true
1818
rustc-hash.workspace = true
1919
serde_json.workspace = true
2020
serde.workspace = true
21-
command-group.workspace = true
21+
process-wrap.workspace = true
2222

2323
# local deps
2424
paths.workspace = true

crates/flycheck/src/command.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use std::{
99
process::{ChildStderr, ChildStdout, Command, Stdio},
1010
};
1111

12-
use command_group::{CommandGroup, GroupChild};
1312
use crossbeam_channel::Sender;
13+
use process_wrap::std::{StdChildWrapper, StdCommandWrap};
1414
use stdx::process::streaming_output;
1515

1616
/// Cargo output is structured as a one JSON per line. This trait abstracts parsing one line of
@@ -85,7 +85,7 @@ impl<T: ParseFromLine> CargoActor<T> {
8585
}
8686
}
8787

88-
struct JodGroupChild(GroupChild);
88+
struct JodGroupChild(Box<dyn StdChildWrapper>);
8989

9090
impl Drop for JodGroupChild {
9191
fn drop(&mut self) {
@@ -119,14 +119,20 @@ impl<T> fmt::Debug for CommandHandle<T> {
119119
impl<T: ParseFromLine> CommandHandle<T> {
120120
pub(crate) fn spawn(mut command: Command, sender: Sender<T>) -> std::io::Result<Self> {
121121
command.stdout(Stdio::piped()).stderr(Stdio::piped()).stdin(Stdio::null());
122-
let mut child = command.group_spawn().map(JodGroupChild)?;
123122

124123
let program = command.get_program().into();
125124
let arguments = command.get_args().map(|arg| arg.into()).collect::<Vec<OsString>>();
126125
let current_dir = command.get_current_dir().map(|arg| arg.to_path_buf());
127126

128-
let stdout = child.0.inner().stdout.take().unwrap();
129-
let stderr = child.0.inner().stderr.take().unwrap();
127+
let mut child = StdCommandWrap::from(command);
128+
#[cfg(unix)]
129+
child.wrap(process_wrap::std::ProcessSession);
130+
#[cfg(windows)]
131+
child.wrap(process_wrap::std::JobObject);
132+
let mut child = child.spawn().map(JodGroupChild)?;
133+
134+
let stdout = child.0.stdout().take().unwrap();
135+
let stderr = child.0.stderr().take().unwrap();
130136

131137
let actor = CargoActor::<T>::new(sender, stdout, stderr);
132138
let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker)

0 commit comments

Comments
 (0)