File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 5
5
"log"
6
6
"os"
7
7
"os/exec"
8
- "syscall"
9
8
10
9
"github.com/shirou/gopsutil/process"
11
10
)
@@ -32,15 +31,14 @@ func stopCommand(cmd *exec.Cmd) {
32
31
fmt .Println ("[*] stopping process" , cmd .Process .Pid )
33
32
proc , err := process .NewProcess (int32 (cmd .Process .Pid ))
34
33
if err != nil {
35
- fmt .Println ("error finding child process:" , err )
36
- err := cmd .Process .Signal (syscall .SIGTERM )
37
- if err != nil {
38
- fmt .Println ("error killing child process:" , err )
34
+ if err .Error () == "process does not exist" {
35
+ return
39
36
}
37
+ fmt .Println ("[*] warning: error finding child process:" , err )
40
38
} else {
41
39
err = proc .Terminate ()
42
40
if err != nil {
43
- fmt .Println ("error killing child process:" , err )
41
+ fmt .Println ("[*] error killing child process:" , err )
44
42
}
45
43
}
46
44
cmd .Process .Wait ()
You can’t perform that action at this time.
0 commit comments