Test Ctrl-C, job control and hangup with an interactive shell on a terminal

This commit is contained in:
2026-11-04 02:50:35 +01:00
parent 04abf264a0
commit 5389ac97ac
5 changed files with 453 additions and 12 deletions
-10
View File
@@ -1,8 +1,6 @@
use std::os::unix::process::{CommandExt, ExitStatusExt};
use std::path::Path;
use std::process::{Child, Stdio};
use std::thread;
use std::time::{Duration, Instant};
use tempfile::TempDir;
@@ -125,14 +123,6 @@ fn spawn_sandbox(args: &[&str], dir: &Path, script: &str) -> (Sandbox, Child) {
(sandbox, child)
}
fn wait_for_file(path: &Path) {
let deadline = Instant::now() + Duration::from_secs(10);
while !path.exists() {
assert!(Instant::now() < deadline, "timed out waiting for {path:?}");
thread::sleep(Duration::from_millis(10));
}
}
fn send_signal(child: &Child, signal: i32) {
unsafe { libc::kill(child.id() as i32, signal) };
}