File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ func runCommand(args []string) *exec.Cmd {
1212 cmd := exec .Command (args [0 ], args [1 :]... )
1313 cmd .Stdout = os .Stdout
1414 cmd .Stderr = os .Stderr
15- cmd . SysProcAttr = & syscall. SysProcAttr { Setpgid : true }
15+ setProcAttr ( cmd )
1616
1717 fmt .Println ("[*] running command:" , cmd )
1818 err := cmd .Start ()
@@ -28,14 +28,8 @@ func stopCommand(cmd *exec.Cmd) {
2828 return
2929 }
3030
31- err := syscall .Kill (- cmd .Process .Pid , syscall .Signal (0 ))
32- if err != nil && err .Error () == "operation not permitted" {
33- // process no longer running, nothing to do here
34- return
35- }
36-
3731 fmt .Println ("[*] stopping process" , cmd .Process .Pid )
38- e := syscall . Kill ( - cmd .Process .Pid , syscall .SIGTERM )
32+ e := cmd .Process .Signal ( syscall .SIGTERM )
3933 if e != nil {
4034 fmt .Println ("error killing child process:" , e )
4135 }
Original file line number Diff line number Diff line change 1+ //go:build linux || darwin
2+
3+ package vproxy
4+
5+ import (
6+ "os/exec"
7+ "syscall"
8+ )
9+
10+ func setProcAttr (cmd * exec.Cmd ) {
11+ cmd .SysProcAttr = & syscall.SysProcAttr {Setpgid : true }
12+ }
Original file line number Diff line number Diff line change 1+ //go:build windows
2+
3+ package vproxy
4+
5+ import (
6+ "os/exec"
7+ "syscall"
8+ )
9+
10+ func setProcAttr (cmd * exec.Cmd ) {
11+ cmd .SysProcAttr = & syscall.SysProcAttr {}
12+ }
You can’t perform that action at this time.
0 commit comments