diff --git a/src/Surface.zig b/src/Surface.zig index 9ab7234d6..e60b82ff7 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -907,12 +907,7 @@ pub fn handleMessage(self: *Surface, msg: Message) !void { }, .close => self.close(), - - // Close without confirmation. - .child_exited => { - self.child_exited = true; - self.close(); - }, + .child_exited => self.child_exited = true, .desktop_notification => |notification| { if (!self.config.desktop_notifications) { diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 317ad13b4..f591544b2 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -418,6 +418,11 @@ fn processExitCommon(td: *termio.Termio.ThreadData, exit_code: u32) void { return; } + // Notify our surface that the child process has exited + _ = td.surface_mailbox.push(.{ + .child_exited = {}, + }, .{ .forever = {} }); + // We output a message so that the user knows whats going on and // doesn't think their terminal just froze. We show this unconditionally // on close even if `wait_after_command` is false and the surface closes @@ -442,7 +447,7 @@ fn processExitCommon(td: *termio.Termio.ThreadData, exit_code: u32) void { // Notify our surface we want to close _ = td.surface_mailbox.push(.{ - .child_exited = {}, + .close = {}, }, .{ .forever = {} }); } @@ -569,6 +574,9 @@ pub fn queueWrite( _ = td.surface_mailbox.push(.{ .child_exited = {}, }, .{ .forever = {} }); + _ = td.surface_mailbox.push(.{ + .close = {}, + }, .{ .forever = {} }); return; }