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

Detect cargo-nextest as top-level cargo test runner #7

Merged
merged 2 commits into from
Nov 27, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.8.1

- When cleaning up old numbered directories if the entry is not found
this error is ignored. This is possible if multiple cleanups are
racing each other.

## v0.8.0

- NumberedDir::create_subdir will no longer ensure to always create a
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "testdir"
version = "0.8.0"
version = "0.8.1"
authors = ["Floris Bruynooghe <[email protected]>"]
edition = "2021"
description = "Semi-persistent, scoped test directories"
Expand Down
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