summaryrefslogtreecommitdiff
path: root/osutil
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-01-05 13:35:58 +0300
committerWolfy-J <[email protected]>2019-01-05 13:35:58 +0300
commit04f7ac73c477938b7390ec6ec101d0e4bcc8cd80 (patch)
tree361c8cd8a00824d0b2e5003c6a5978f630c20469 /osutil
parent46009112a783a1fdae95e0a061d4c8c41a1c8ff1 (diff)
second set of patches
Diffstat (limited to 'osutil')
-rw-r--r--osutil/cmd_group.go13
-rw-r--r--osutil/cmd_group_win.go13
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}
+}