Skip to content

Commit a211626

Browse files
committed
mac test
1 parent 2f32614 commit a211626

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ pub async fn run_command_with_timeout(
497497
std_cmd.pre_exec(|| {
498498
// libc::setpgid(0, 0) makes the new process its own group leader.
499499
// Pass 0 for both pid and pgid to achieve this for the calling process.
500-
if libc::setpgid(0, 0) == 0 {
500+
if nix::unistd::setpgid(Pid::from_raw(0),Pid::from_raw(0)) == Ok(()) {
501501
Ok(())
502502
} else {
503503
// Capture the error from the OS if setpgid fails
@@ -948,16 +948,10 @@ mod tests {
948948
result.duration > Duration::from_secs(2),
949949
"Duration should be > 2s"
950950
); // 20 * 0.1s
951-
#[cfg(not(target_os = "macos"))]
952951
assert!(
953952
result.duration < Duration::from_secs(3),
954953
"Duration should be < 3s"
955954
);
956-
#[cfg(target_os = "macos")]
957-
assert!(
958-
result.duration < Duration::from_secs(4),
959-
"Duration should be < 4s"
960-
); // macOS has longer sleep resolution
961955
});
962956
}
963957

0 commit comments

Comments
 (0)