core: add Surface.stopProcess

This keeps the IO backend interaction inside of the owning Surface code.
pull/9760/head
Jon Parise 2025-12-12 09:57:04 -05:00
parent 75953d7ca7
commit 0bce07d92f
2 changed files with 9 additions and 3 deletions

View File

@ -801,6 +801,14 @@ pub fn close(self: *Surface) void {
self.rt_surface.close(self.needsConfirmQuit());
}
/// Stop the child process by sending it the kill command (SIGHUP).
/// child_exited will be set once the child process has stopped.
pub fn stopProcess(self: *Surface) void {
switch (self.io.backend) {
.exec => |*exec| exec.subprocess.stop(),
}
}
/// Returns a mailbox that can be used to send messages to this surface.
inline fn surfaceMailbox(self: *Surface) Mailbox {
return .{

View File

@ -1544,9 +1544,7 @@ pub const CAPI = struct {
/// Stops the child process by sending it the kill command (SIGHUP).
export fn ghostty_surface_process_stop(surface: *Surface) void {
switch (surface.core_surface.io.backend) {
.exec => |*exec| exec.subprocess.stop(),
}
surface.core_surface.stopProcess();
}
/// Returns true if the surface has a selection.