Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Executable() in ps.Processes does not return the full process name #2

Open
miroswan opened this issue May 12, 2015 · 4 comments
Open

Comments

@miroswan
Copy link

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?

@vtolstov
Copy link

vtolstov commented Dec 7, 2015

please check pr #6

@SimonSchick
Copy link

I have the same problem as well, any chance #6 will actually get merged? @mitchellh

@gabriel
Copy link

gabriel commented May 14, 2016

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.)

@SimonSchick
Copy link

That looks useful, ty.

daftaupe pushed a commit to daftaupe/go-ps that referenced this issue Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants