Skip to content

Commit 1a1ac6c

Browse files
committed
Rollup merge of rust-lang#22404 - semarie:signal_reported_right, r=aturon
The test \"signal_reported_right\" send a signal `1` to `/bin/sh`, and check the status code to check if the signal is reported right. Under OpenBSD, the signal `1` (`SIGHUP`) is catched by `/bin/sh`, resulting the test failed. Use the uncatchable signal `9` (`SIGKILL`) for test.
2 parents 5e0adf2 + 5a6ea7a commit 1a1ac6c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/libstd/old_io/process.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,12 +800,12 @@ mod tests {
800800
#[cfg(all(unix, not(target_os="android")))]
801801
#[test]
802802
fn signal_reported_right() {
803-
let p = Command::new("/bin/sh").arg("-c").arg("kill -1 $$").spawn();
803+
let p = Command::new("/bin/sh").arg("-c").arg("kill -9 $$").spawn();
804804
assert!(p.is_ok());
805805
let mut p = p.unwrap();
806806
match p.wait().unwrap() {
807-
process::ExitSignal(1) => {},
808-
result => panic!("not terminated by signal 1 (instead, {})", result),
807+
process::ExitSignal(9) => {},
808+
result => panic!("not terminated by signal 9 (instead, {})", result),
809809
}
810810
}
811811

src/libstd/process.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,12 @@ mod tests {
537537
fn signal_reported_right() {
538538
use os::unix::ExitStatusExt;
539539

540-
let p = Command::new("/bin/sh").arg("-c").arg("kill -1 $$").spawn();
540+
let p = Command::new("/bin/sh").arg("-c").arg("kill -9 $$").spawn();
541541
assert!(p.is_ok());
542542
let mut p = p.unwrap();
543543
match p.wait().unwrap().signal() {
544-
Some(1) => {},
545-
result => panic!("not terminated by signal 1 (instead, {:?})", result),
544+
Some(9) => {},
545+
result => panic!("not terminated by signal 9 (instead, {:?})", result),
546546
}
547547
}
548548

0 commit comments

Comments
 (0)