tests: make sure sway's subprocesses are killed before killing sway

This fixes the tests when run within Debian's autopkgtest. Since there
were still some living child processes, autopkgtest was stuck waiting
for them forever.
This commit is contained in:
Skia 2025-09-09 12:57:45 +02:00
parent 351cb5dd66
commit 75806d081f

View file

@ -107,6 +107,10 @@ impl Sway {
} }
fn stop(&mut self) { fn stop(&mut self) {
// in case some apps were spawned, kill them, and give them some time to be killed
self.send_command(["[all] kill"].as_slice());
std::thread::sleep(std::time::Duration::from_millis(500));
// now terminate sway
signal(self.process.id(), "TERM"); signal(self.process.id(), "TERM");
match self.check_connection("Unable to connect to") { match self.check_connection("Unable to connect to") {
Ok(()) => eprintln!("Sway terminated correctly on its own"), Ok(()) => eprintln!("Sway terminated correctly on its own"),