Skip to content

Commit

Permalink
Prevent race conditions on waiting for children
Browse files Browse the repository at this point in the history
  • Loading branch information
kosayoda committed Sep 23, 2024
1 parent 91d37e5 commit 8d1cda7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test_spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus};

#[test]
fn spawn_true() {
let _m = crate::FORK_MTX.lock();
let bin = &CString::new("true").unwrap();
let args = &[
CString::new("true").unwrap(),
Expand All @@ -32,6 +33,8 @@ fn spawn_true() {

#[test]
fn spawn_sleep() {
let _m = crate::FORK_MTX.lock();

let bin = &CString::new("sleep").unwrap();
let args = &[CString::new("sleep").unwrap(), CString::new("30").unwrap()];
let vars: &[CString] = &[];
Expand Down Expand Up @@ -66,6 +69,8 @@ fn spawn_sleep() {

#[test]
fn spawn_fail() {
let _m = crate::FORK_MTX.lock();

let bin = &CString::new("3f0ffc950ccd2fb8").unwrap();
let args = &[CString::new("3f0ffc950ccd2fb8").unwrap()];
let vars: &[CString] = &[];
Expand Down

0 comments on commit 8d1cda7

Please sign in to comment.