Skip to content

Commit 86dc293

Browse files
authored
Merge pull request #8430 from martinkunkel2/more-test-fix
more: tests: cleanup processes in test_valid_arg
2 parents 1b742bb + e5a2f89 commit 86dc293

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

tests/by-util/test_more.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,22 @@ fn test_valid_arg() {
4646

4747
fn test_alive(args: &[&str]) {
4848
let (at, mut ucmd) = at_and_ucmd!();
49+
50+
let content = "test content";
4951
let file = "test_file";
50-
at.touch(file);
52+
at.write(file, content);
53+
54+
let mut cmd = ucmd.args(args).arg(file).run_no_wait();
55+
56+
// wait for more to start and display the file
57+
while cmd.is_alive() && !cmd.stdout_all().contains(content) {
58+
cmd.delay(50);
59+
}
60+
61+
assert!(cmd.is_alive(), "Command should still be alive");
5162

52-
ucmd.args(args)
53-
.arg(file)
54-
.run_no_wait()
55-
.make_assertion()
56-
.is_alive();
63+
// cleanup
64+
cmd.kill();
5765
}
5866

5967
#[test]

0 commit comments

Comments
 (0)