mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
clippy: spawned process is never 'wait()'ed on
This commit is contained in:
parent
41a3695b3f
commit
a3a4457a44
2 changed files with 9 additions and 6 deletions
|
@ -1658,13 +1658,14 @@ fn test_reading_partial_blocks_from_fifo() {
|
||||||
// Start different processes to write to the FIFO, with a small
|
// Start different processes to write to the FIFO, with a small
|
||||||
// pause in between.
|
// pause in between.
|
||||||
let mut writer_command = Command::new("sh");
|
let mut writer_command = Command::new("sh");
|
||||||
writer_command
|
let _ = writer_command
|
||||||
.args([
|
.args([
|
||||||
"-c",
|
"-c",
|
||||||
&format!("(printf \"ab\"; sleep 0.1; printf \"cd\") > {fifoname}"),
|
&format!("(printf \"ab\"; sleep 0.1; printf \"cd\") > {fifoname}"),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
.wait();
|
||||||
|
|
||||||
let output = child.wait_with_output().unwrap();
|
let output = child.wait_with_output().unwrap();
|
||||||
assert_eq!(output.stdout, b"abcd");
|
assert_eq!(output.stdout, b"abcd");
|
||||||
|
@ -1701,13 +1702,14 @@ fn test_reading_partial_blocks_from_fifo_unbuffered() {
|
||||||
// Start different processes to write to the FIFO, with a small
|
// Start different processes to write to the FIFO, with a small
|
||||||
// pause in between.
|
// pause in between.
|
||||||
let mut writer_command = Command::new("sh");
|
let mut writer_command = Command::new("sh");
|
||||||
writer_command
|
let _ = writer_command
|
||||||
.args([
|
.args([
|
||||||
"-c",
|
"-c",
|
||||||
&format!("(printf \"ab\"; sleep 0.1; printf \"cd\") > {fifoname}"),
|
&format!("(printf \"ab\"; sleep 0.1; printf \"cd\") > {fifoname}"),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
.wait();
|
||||||
|
|
||||||
let output = child.wait_with_output().unwrap();
|
let output = child.wait_with_output().unwrap();
|
||||||
assert_eq!(output.stdout, b"abcd");
|
assert_eq!(output.stdout, b"abcd");
|
||||||
|
|
|
@ -36,13 +36,14 @@ impl Target {
|
||||||
Self { child }
|
Self { child }
|
||||||
}
|
}
|
||||||
fn send_signal(&mut self, signal: Signal) {
|
fn send_signal(&mut self, signal: Signal) {
|
||||||
Command::new("kill")
|
let _ = Command::new("kill")
|
||||||
.args(&[
|
.args(&[
|
||||||
format!("-{}", signal as i32),
|
format!("-{}", signal as i32),
|
||||||
format!("{}", self.child.id()),
|
format!("{}", self.child.id()),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("failed to send signal");
|
.expect("failed to send signal")
|
||||||
|
.wait();
|
||||||
self.child.delay(100);
|
self.child.delay(100);
|
||||||
}
|
}
|
||||||
fn is_alive(&mut self) -> bool {
|
fn is_alive(&mut self) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue