fix(root): now kill all child processes
- I got a problem with kitty image protocol
This commit is contained in:
+4
-3
@@ -169,6 +169,7 @@ func runWrapper() {
|
|||||||
c.ExtraFiles = make([]*os.File, 11)
|
c.ExtraFiles = make([]*os.File, 11)
|
||||||
c.ExtraFiles[10] = w
|
c.ExtraFiles[10] = w
|
||||||
c.Env = adapter.GetEnv(10, os.Getpid())
|
c.Env = adapter.GetEnv(10, os.Getpid())
|
||||||
|
c.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
||||||
|
|
||||||
ptmx, err := pty.Start(c)
|
ptmx, err := pty.Start(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -202,10 +203,10 @@ func runWrapper() {
|
|||||||
os.Setenv("IRIS_ACTIVE_SHELL", innerShell)
|
os.Setenv("IRIS_ACTIVE_SHELL", innerShell)
|
||||||
}
|
}
|
||||||
|
|
||||||
// kill the child shell before reloading
|
// kill the child process group before reloading
|
||||||
// this prevents multiple shells from fighting over the terminal
|
// using negative PID to kill all descendants
|
||||||
if c.Process != nil {
|
if c.Process != nil {
|
||||||
_ = syscall.Kill(c.Process.Pid, syscall.SIGKILL)
|
_ = syscall.Kill(-c.Process.Pid, syscall.SIGKILL)
|
||||||
ptmx.Close()
|
ptmx.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user