如何获取Go中当前正在运行的进程列表?
操作系统包提供了一些功能:http://golang.org/pkg/os/ 但是没有任何内容可以查看正在运行的进程列表.
以下工作并打印命令输出:
out, err := exec.Command("ps", "cax").Output()
Run Code Online (Sandbox Code Playgroud)
但是这个失败了(退出状态为1):
out, err := exec.Command("ps", "cax | grep myapp").Output()
Run Code Online (Sandbox Code Playgroud)
有什么建议?