From 2c01b2259ebb493835c2722baada4ee2e2d7985c Mon Sep 17 00:00:00 2001 From: verse91 Date: Sun, 12 Apr 2026 00:00:40 +0700 Subject: [PATCH] fix(root): now kill all child processes - I got a problem with kitty image protocol --- root/root.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/root/root.go b/root/root.go index 72bf652..ac945af 100644 --- a/root/root.go +++ b/root/root.go @@ -169,6 +169,7 @@ func runWrapper() { c.ExtraFiles = make([]*os.File, 11) c.ExtraFiles[10] = w c.Env = adapter.GetEnv(10, os.Getpid()) + c.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} ptmx, err := pty.Start(c) if err != nil { @@ -202,10 +203,10 @@ func runWrapper() { os.Setenv("IRIS_ACTIVE_SHELL", innerShell) } - // kill the child shell before reloading - // this prevents multiple shells from fighting over the terminal + // kill the child process group before reloading + // using negative PID to kill all descendants if c.Process != nil { - _ = syscall.Kill(c.Process.Pid, syscall.SIGKILL) + _ = syscall.Kill(-c.Process.Pid, syscall.SIGKILL) ptmx.Close() }