Skip to content

Commit 772e48c

Browse files
committed
minor: replace command-group with process-wrap
Because command-group no longer receives updates and depends on an older version of nix.
1 parent c1b0516 commit 772e48c

File tree

4 files changed

+73
-45
lines changed

4 files changed

+73
-45
lines changed

src/tools/rust-analyzer/Cargo.lock

Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,6 @@ dependencies = [
216216
"tracing",
217217
]
218218

219-
[[package]]
220-
name = "command-group"
221-
version = "2.1.0"
222-
source = "registry+https://github.com/rust-lang/crates.io-index"
223-
checksum = "5080df6b0f0ecb76cab30808f00d937ba725cebe266a3da8cd89dff92f2a9916"
224-
dependencies = [
225-
"nix 0.26.4",
226-
"winapi",
227-
]
228-
229219
[[package]]
230220
name = "countme"
231221
version = "3.0.1"
@@ -292,7 +282,7 @@ version = "3.4.4"
292282
source = "registry+https://github.com/rust-lang/crates.io-index"
293283
checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345"
294284
dependencies = [
295-
"nix 0.28.0",
285+
"nix",
296286
"windows-sys 0.52.0",
297287
]
298288

@@ -432,9 +422,9 @@ name = "flycheck"
432422
version = "0.0.0"
433423
dependencies = [
434424
"cargo_metadata",
435-
"command-group",
436425
"crossbeam-channel",
437426
"paths",
427+
"process-wrap",
438428
"rustc-hash",
439429
"serde",
440430
"serde_json",
@@ -1121,17 +1111,6 @@ dependencies = [
11211111
"windows-sys 0.48.0",
11221112
]
11231113

1124-
[[package]]
1125-
name = "nix"
1126-
version = "0.26.4"
1127-
source = "registry+https://github.com/rust-lang/crates.io-index"
1128-
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
1129-
dependencies = [
1130-
"bitflags 1.3.2",
1131-
"cfg-if",
1132-
"libc",
1133-
]
1134-
11351114
[[package]]
11361115
name = "nix"
11371116
version = "0.28.0"
@@ -1397,6 +1376,18 @@ dependencies = [
13971376
"unicode-ident",
13981377
]
13991378

1379+
[[package]]
1380+
name = "process-wrap"
1381+
version = "8.0.2"
1382+
source = "registry+https://github.com/rust-lang/crates.io-index"
1383+
checksum = "38ee68ae331824036479c84060534b18254c864fa73366c58d86db3b7b811619"
1384+
dependencies = [
1385+
"indexmap",
1386+
"nix",
1387+
"tracing",
1388+
"windows",
1389+
]
1390+
14001391
[[package]]
14011392
name = "profile"
14021393
version = "0.0.0"
@@ -2375,35 +2366,66 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
23752366
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
23762367

23772368
[[package]]
2378-
name = "winapi"
2379-
version = "0.3.9"
2369+
name = "winapi-util"
2370+
version = "0.1.8"
2371+
source = "registry+https://github.com/rust-lang/crates.io-index"
2372+
checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
2373+
dependencies = [
2374+
"windows-sys 0.52.0",
2375+
]
2376+
2377+
[[package]]
2378+
name = "windows"
2379+
version = "0.56.0"
23802380
source = "registry+https://github.com/rust-lang/crates.io-index"
2381-
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
2381+
checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132"
23822382
dependencies = [
2383-
"winapi-i686-pc-windows-gnu",
2384-
"winapi-x86_64-pc-windows-gnu",
2383+
"windows-core",
2384+
"windows-targets 0.52.5",
23852385
]
23862386

23872387
[[package]]
2388-
name = "winapi-i686-pc-windows-gnu"
2389-
version = "0.4.0"
2388+
name = "windows-core"
2389+
version = "0.56.0"
23902390
source = "registry+https://github.com/rust-lang/crates.io-index"
2391-
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
2391+
checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6"
2392+
dependencies = [
2393+
"windows-implement",
2394+
"windows-interface",
2395+
"windows-result",
2396+
"windows-targets 0.52.5",
2397+
]
23922398

23932399
[[package]]
2394-
name = "winapi-util"
2395-
version = "0.1.8"
2400+
name = "windows-implement"
2401+
version = "0.56.0"
23962402
source = "registry+https://github.com/rust-lang/crates.io-index"
2397-
checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
2403+
checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b"
23982404
dependencies = [
2399-
"windows-sys 0.52.0",
2405+
"proc-macro2",
2406+
"quote",
2407+
"syn",
24002408
]
24012409

24022410
[[package]]
2403-
name = "winapi-x86_64-pc-windows-gnu"
2404-
version = "0.4.0"
2411+
name = "windows-interface"
2412+
version = "0.56.0"
24052413
source = "registry+https://github.com/rust-lang/crates.io-index"
2406-
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
2414+
checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc"
2415+
dependencies = [
2416+
"proc-macro2",
2417+
"quote",
2418+
"syn",
2419+
]
2420+
2421+
[[package]]
2422+
name = "windows-result"
2423+
version = "0.1.1"
2424+
source = "registry+https://github.com/rust-lang/crates.io-index"
2425+
checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b"
2426+
dependencies = [
2427+
"windows-targets 0.52.5",
2428+
]
24072429

24082430
[[package]]
24092431
name = "windows-sys"

src/tools/rust-analyzer/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"

src/tools/rust-analyzer/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

src/tools/rust-analyzer/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)