diff options
Diffstat (limited to 'test/process/flags.zig')
| -rw-r--r-- | test/process/flags.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/process/flags.zig b/test/process/flags.zig index 2ae8d0c7..a6797901 100644 --- a/test/process/flags.zig +++ b/test/process/flags.zig @@ -701,6 +701,8 @@ fn killedTty(gpa: std.mem.Allocator, exe: [:0]const u8) !void { const a = arena.allocator(); var d = try process.Detached.start(gpa, exe, "killed", .{}); defer d.deinit(); + // Before the deinit, a failure's way out too: else the root comes back. + defer daemonGone(&d); // Killed with SIGTERM or SIGHUP, a tty editor puts its terminal back // (main screen, cooked mode) before it dies, and its 9P socket goes // with it. One a dead editor left (no process has its pid) is swept at @@ -761,6 +763,7 @@ fn signalCleansUp(gpa: std.mem.Allocator, exe: [:0]const u8) !void { for ([_]libc.SIG{ .TERM, .INT, .HUP }) |first| { var d = try process.Detached.start(gpa, exe, "sig", .{ .env = &.{.{ "PARDES_DAEMON", "on" }} }); defer d.deinit(); + defer daemonGone(&d); try std.testing.expect(d.exists("pardes-9p-sig.sock")); var sig = first; if (sig == .HUP) { @@ -773,6 +776,5 @@ fn signalCleansUp(gpa: std.mem.Allocator, exe: [:0]const u8) !void { const deadline = process.nowMs() + 5_000; while (d.exists("pardes-9p-sig.sock") and process.nowMs() < deadline) process.nap(10); try check(!d.exists("pardes-9p-sig.sock"), "{t}: the socket left", .{first}); - daemonGone(&d); } } |
