mirror of
https://gitee.com/johng/gf
synced 2026-06-27 01:43:33 +08:00
17 lines
290 B
Go
17 lines
290 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gogf/gf/g/os/gproc"
|
|
)
|
|
|
|
// 使用gproc kill指定其他进程(清确保运行该程序的用户有足够权限)
|
|
func main() {
|
|
pid := 28536
|
|
m := gproc.NewManager()
|
|
m.AddProcess(pid)
|
|
m.KillAll()
|
|
m.WaitAll()
|
|
fmt.Printf("%d was killed\n", pid)
|
|
}
|