aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crates/yt/tests/_testenv/init.rs15
-rw-r--r--crates/yt/tests/_testenv/mod.rs4
-rw-r--r--crates/yt/tests/_testenv/run.rs6
3 files changed, 8 insertions, 17 deletions
diff --git a/crates/yt/tests/_testenv/init.rs b/crates/yt/tests/_testenv/init.rs
index a584dc9..d797ed8 100644
--- a/crates/yt/tests/_testenv/init.rs
+++ b/crates/yt/tests/_testenv/init.rs
@@ -3,11 +3,8 @@ use std::{
fs::{self, OpenOptions},
io::{self, Write},
path::PathBuf,
- process,
};
-use libc::SIGINT;
-
use crate::{_testenv::Paths, testenv::TestEnv};
fn target_dir() -> PathBuf {
@@ -122,16 +119,8 @@ impl TestEnv {
impl Drop for TestEnv {
fn drop(&mut self) {
- for _ in &self.spawned_childs {
- // unsafe {
- // TODO(@bpeetz): Use the PidFd feature. <2025-07-07>
- // I would rather have zombie processes instead of killing random pid (they could have
- // been recycled since we spawned the original command.)
- // assert_eq!(
- // libc::kill(i32::try_from(*pid).expect("Should be small enough"), SIGINT),
- // 0
- // );
- // };
+ for child in &mut self.spawned_childs {
+ drop(child.kill());
}
}
}
diff --git a/crates/yt/tests/_testenv/mod.rs b/crates/yt/tests/_testenv/mod.rs
index fe3f3b8..4798d5d 100644
--- a/crates/yt/tests/_testenv/mod.rs
+++ b/crates/yt/tests/_testenv/mod.rs
@@ -1,6 +1,6 @@
//! This code was taken from *fd* at 30-06-2025.
-use std::path::PathBuf;
+use std::{path::PathBuf, process};
mod init;
mod run;
@@ -14,7 +14,7 @@ pub(crate) struct TestEnv {
pub(crate) paths: Paths,
- pub(crate) spawned_childs: Vec<u32>,
+ pub(crate) spawned_childs: Vec<process::Child>,
}
pub(crate) struct Paths {
diff --git a/crates/yt/tests/_testenv/run.rs b/crates/yt/tests/_testenv/run.rs
index 74f5e86..85c914f 100644
--- a/crates/yt/tests/_testenv/run.rs
+++ b/crates/yt/tests/_testenv/run.rs
@@ -125,9 +125,11 @@ impl TestEnv {
#[allow(clippy::zombie_processes)]
let mut child = cmd.spawn().expect("yt spawn");
- self.spawned_childs.push(child.id());
+ let stdout = child.stdout.take().expect("Was piped");
- child.stdout.take().expect("Was piped")
+ self.spawned_childs.push(child);
+
+ stdout
}
fn finalize_cmd(mut cmd: process::Command, args: &[&str]) -> String {