Added parallel computing

master
Paulo Simão 2021-10-24 22:08:43 -03:00
parent da1957a8c6
commit 2195674c08
1 changed files with 12 additions and 0 deletions

12
lib.go
View File

@ -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))
}
}