Added parallel computing
parent
da1957a8c6
commit
2195674c08
12
lib.go
12
lib.go
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
@ -250,3 +251,14 @@ func Exec(str string, opts ...*Opts) error {
|
|||
return nil
|
||||
|
||||
}
|
||||
|
||||
// Kill call OS to kill pid
|
||||
func Kill(p int) error {
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
return Exec(fmt.Sprintf("taskkill /T /F /PID %d", p))
|
||||
default:
|
||||
return Exec(fmt.Sprintf("kill -9 %d", p))
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue