aboutsummaryrefslogtreecommitdiff
path: root/src/detect
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-27 22:38:56 +0200
committerGitHub <noreply@github.com>2026-09-27 22:38:56 +0200
commit0d5d6f1f317e238c8297076bc6ab5c3a0cd56283 (patch)
tree132684253296f996977dd8b31aa2f156c2ed4577 /src/detect
parent2527eed26354dd18090b3de29f7fa0f7a1872540 (diff)
test: fix pane shell idle foreground-command race (#4691)
The interactive-shell idle test sent SIGINT as soon as it observed the shell was busy. That condition can be true before the shell finishes moving the command into its own foreground process group, so the interrupt could arrive before the command reset its signal dispositions. The command then survived in a stale foreground group while the shell showed a prompt, and the pane was never observed idle again. Run cat and end it with EOF instead. cat blocks on stdin, so the busy state is stable, and EOF avoids the interrupt/job-control race.
Diffstat (limited to 'src/detect')
-rw-r--r--src/detect/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/detect/mod.rs b/src/detect/mod.rs
index 7d7759d2..146c3089 100644
--- a/src/detect/mod.rs
+++ b/src/detect/mod.rs
@@ -1962,9 +1962,15 @@ mod tests {
let mut writer = pair.master.take_writer().expect("no writer");
assert!(wait_for(true, pid), "interactive shell should start idle");
- writer.write_all(b"sleep 999\n").unwrap();
+ // End the foreground command with EOF rather than SIGINT. An interrupt
+ // sent while the shell is still moving the command into its own
+ // foreground process group can be delivered before the command resets
+ // its signal dispositions, leaving it running in a stale foreground
+ // group while the shell shows a prompt. `cat` blocks until stdin hits
+ // EOF, so it stays reliably busy until we end it.
+ writer.write_all(b"cat\n").unwrap();
assert!(wait_for(false, pid), "shell running a command is not idle");
- writer.write_all(&[3]).unwrap();
+ writer.write_all(&[4]).unwrap();
assert!(
wait_for(true, pid),
"shell should be idle after the command ends"