You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gosuv/vendor/github.com/codeskyblue/kexec/tests/main.go

23 lines
345 B

package main
import (
"fmt"
"kproc"
"log"
"os/exec"
"syscall"
"time"
)
func main() {
p := kproc.ProcString("python flask_main.py")
p.Start()
time.Sleep(10 * time.Second)
err := p.Terminate(syscall.SIGKILL)
if err != nil {
log.Println(err)
}
out, _ := exec.Command("lsof", "-i:5000").CombinedOutput()
fmt.Println(string(out))
}