go-ps
go-ps copied to clipboard
Executable() in ps.Processes does not return the full process name
Code
package main
import (
"fmt"
"log"
ps "github.com/mitchellh/go-ps"
)
func main() {
if p, err := ps.Processes(); err != nil {
log.Fatal(err)
} else {
for _, v := range p {
fmt.Println(v.Executable())
}
}
}
Example Truncated process: NetworkBrowserAg
Is this a limitation of the system call sysctl or the implementation of the darwinProcesses() C function? It would be nice to have the full process name in order to instill confidence when selecting processes by name.
This tool will be largely helpful for systems /(administrators|engineers)/ who want to move to Go from the standard interpreted variety (which is great because packaging and deploying is easier). If the full process name is available, I wager that go-ps would be a bit more practical! What do you think?
please check pr #6
I have the same problem as well, any chance #6 will actually get merged? @mitchellh
In this fork, https://github.com/keybase/go-ps, I added a Path() method to Process which returns the full path to executable.
Supported on windows and darwin. (Uses the yeonsh patch for darwin.)
That looks useful, ty.