7 Star 26 Fork 2

Gitee 极速下载 / goworld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/xiaonanln/goworld
克隆/下载
process.go 798 Bytes
一键复制 编辑 原始数据 按行查看 历史
seis 提交于 2018-06-17 12:20 . goworld status
package process
import (
"syscall"
psutil_process "github.com/shirou/gopsutil/process"
)
type Process interface {
Pid() int32
Executable() string
Path() (string, error)
CmdlineSlice() ([]string, error)
Cwd() (string, error)
Signal(sig syscall.Signal)
}
type process struct {
*psutil_process.Process
}
func (p process) Pid() int32 {
return p.Process.Pid
}
func (p process) Executable() string {
name, _ := p.Process.Name()
return name
}
func (p process) Path() (string, error) {
return p.Process.Exe()
}
func (p process) test() {
}
func Processes() ([]Process, error) {
var procs []Process
ps, err := psutil_process.Processes()
if err != nil {
return nil, err
}
for _, _p := range ps {
p := &process{_p}
p.test()
procs = append(procs, p)
}
return procs, nil
}
1
https://gitee.com/mirrors/goworld.git
git@gitee.com:mirrors/goworld.git
mirrors
goworld
goworld
v0.1.6

搜索帮助