forked from Silverfish/proton-bridge
GODT-2111: Give the child process its own group ID
This commit is contained in:
@ -20,8 +20,16 @@
|
|||||||
|
|
||||||
package restarter
|
package restarter
|
||||||
|
|
||||||
import "os/exec"
|
import (
|
||||||
|
"os/exec"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
func run(cmd *exec.Cmd) error {
|
func run(cmd *exec.Cmd) error {
|
||||||
|
// Provide a new Group ID to the new process to ensure the child is detached even if parent crash before ending.
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||||
|
Setpgid: true,
|
||||||
|
Pgid: 0,
|
||||||
|
}
|
||||||
return cmd.Start()
|
return cmd.Start()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,8 +20,15 @@
|
|||||||
|
|
||||||
package restarter
|
package restarter
|
||||||
|
|
||||||
import "os/exec"
|
import (
|
||||||
|
"os/exec"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
func run(cmd *exec.Cmd) error {
|
func run(cmd *exec.Cmd) error {
|
||||||
|
// Provide a new Group ID to the new process to ensure the child is detached even if parent crash before ending.
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||||
|
CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP,
|
||||||
|
}
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user