diff options
Diffstat (limited to 'osutil')
-rw-r--r-- | osutil/cmd_group.go | 13 | ||||
-rw-r--r-- | osutil/cmd_group_win.go | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/osutil/cmd_group.go b/osutil/cmd_group.go new file mode 100644 index 00000000..d4b64fb6 --- /dev/null +++ b/osutil/cmd_group.go @@ -0,0 +1,13 @@ +// +build !windows + +package osutil + +import ( + "os/exec" + "syscall" +) + +// IsolateProcess change gpid for the process to avoid bypassing signals to php processes. +func IsolateProcess(cmd *exec.Cmd) { + cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true, Pgid: 0} +} diff --git a/osutil/cmd_group_win.go b/osutil/cmd_group_win.go new file mode 100644 index 00000000..ca7fca20 --- /dev/null +++ b/osutil/cmd_group_win.go @@ -0,0 +1,13 @@ +// +build windows + +package osutil + +import ( + "os/exec" + "syscall" +) + +// IsolateProcess change gpid for the process to avoid bypassing signals to php processes. +func IsolateProcess(cmd *exec.Cmd) { + cmd.SysProcAttr = &syscall.SysProcAttr{CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP} +} |