mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 13:18:01 +08:00
17 lines
317 B
Go
17 lines
317 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gitee.com/johng/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)
|
|
}
|