Skip to content

Commit

Permalink
Detect cargo-nextest as top-level cargo test runner
Browse files Browse the repository at this point in the history
This accepts cargo-nextest as the top-level binary that drives a cargo
testrun.  This fixes the re-using of the numbered testdir between all
the processeses started by a testrun under cargo-nextest.  Probably.
  • Loading branch information
flub committed Nov 25, 2023
1 parent 8a33c59 commit 0aea1c0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::ffi::OsStr;
use std::fs;
use std::path::Path;

// use heim::process::Pid;
use once_cell::sync::Lazy;
use sysinfo::{Pid, ProcessExt, SystemExt};

Expand All @@ -19,7 +18,6 @@ pub use cargo_metadata;
const CARGO_PID_FILE_NAME: &str = "cargo-pid";

/// Whether we are a cargo sub-process.
// static CARGO_PID: Lazy<Option<Pid>> = Lazy::new(|| smol::block_on(async { cargo_pid().await }));
static CARGO_PID: Lazy<Option<Pid>> = Lazy::new(cargo_pid);

/// Returns the process ID of our parent Cargo process.
Expand All @@ -45,7 +43,7 @@ fn cargo_pid() -> Option<Pid> {
let parent = sys.process(ppid)?;
let parent_exe = parent.exe();
let parent_file_name = parent_exe.file_name()?;
if parent_file_name == OsStr::new("cargo") {
if parent_file_name == OsStr::new("cargo") || parent_file_name == OsStr::new("cargo-nextest") {
Some(parent.pid())
} else if parent_file_name == OsStr::new("rustdoc") {
let ppid = parent.parent()?;
Expand Down

0 comments on commit 0aea1c0

Please sign in to comment.