Skip to content

Commit 2441b49

Browse files
committed
[nextest-runner] update win32job to get Send and Sync impls
win32job 1.0.2 has Send and Sync impls -- use those.
1 parent d9d2c2b commit 2441b49

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

Cargo.lock

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

nextest-runner/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ windows = { version = "0.39.0", features = [
8888
"Win32_System_Console",
8989
"Win32_System_JobObjects",
9090
] }
91-
win32job = "1.0.1"
91+
win32job = "1.0.2"
9292

9393
[dev-dependencies]
9494
color-eyre = { version = "0.6.2", default-features = false }

nextest-runner/src/runner.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ impl<'a> TestRunnerInner<'a> {
470470

471471
// If creating a job fails, we might be on an old system. Ignore this -- job objects are a
472472
// best-effort thing.
473-
let job = imp::Job::new().ok();
473+
let job = imp::Job::create().ok();
474474

475475
if !self.no_capture {
476476
// Capture stdout and stderr.
@@ -1241,6 +1241,7 @@ pub fn configure_handle_inheritance(
12411241
#[cfg(windows)]
12421242
mod imp {
12431243
use super::*;
1244+
pub(super) use win32job::Job;
12441245
use win32job::JobError;
12451246
use windows::Win32::{
12461247
Foundation::{SetHandleInformation, HANDLE, HANDLE_FLAGS, HANDLE_FLAG_INHERIT},
@@ -1286,24 +1287,6 @@ mod imp {
12861287
// TODO: set process group on Windows for better ctrl-C handling.
12871288
}
12881289

1289-
/// Wrapper around a Job that implements Send and Sync.
1290-
#[derive(Debug)]
1291-
pub(super) struct Job {
1292-
inner: win32job::Job,
1293-
}
1294-
1295-
impl Job {
1296-
pub(super) fn new() -> Result<Self, JobError> {
1297-
Ok(Self {
1298-
inner: win32job::Job::create()?,
1299-
})
1300-
}
1301-
}
1302-
1303-
// https://github.com/ohadravid/win32job-rs/issues/1
1304-
unsafe impl Send for Job {}
1305-
unsafe impl Sync for Job {}
1306-
13071290
pub(super) fn assign_process_to_job(
13081291
child: &tokio::process::Child,
13091292
job: Option<&Job>,
@@ -1319,7 +1302,7 @@ mod imp {
13191302
}
13201303
};
13211304

1322-
job.inner.assign_process(handle)?;
1305+
job.assign_process(handle)?;
13231306
}
13241307

13251308
Ok(())
@@ -1337,7 +1320,7 @@ mod imp {
13371320
return;
13381321
}
13391322
if let Some(job) = job {
1340-
let handle = job.inner.handle();
1323+
let handle = job.handle();
13411324
unsafe {
13421325
// Ignore the error here -- it's likely due to the process exiting.
13431326
// Note: 1 is the exit code returned by Windows.
@@ -1394,7 +1377,7 @@ mod imp {
13941377
pub(super) struct Job(());
13951378

13961379
impl Job {
1397-
pub(super) fn new() -> Result<Self, Infallible> {
1380+
pub(super) fn create() -> Result<Self, Infallible> {
13981381
Ok(Self(()))
13991382
}
14001383
}

0 commit comments

Comments
 (0)