diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 33cf73b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: go - -go: - - 1.18 diff --git a/README.md b/README.md index 8e8baf9..4e3d0e1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Process List Library for Go +# Process List Library for Go [![GoDoc](https://godoc.org/github.com/mitchellh/go-ps?status.png)](https://godoc.org/github.com/mitchellh/go-ps) go-ps is a library for Go that implements OS-specific APIs to list and manipulate processes in a platform-safe way. The library can find and diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..ef9cd7e --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/goss-org/go-ps + +go 1.13 diff --git a/process_freebsd.go b/process_freebsd.go index 0212b66..130acbe 100644 --- a/process_freebsd.go +++ b/process_freebsd.go @@ -1,4 +1,4 @@ -// +build freebsd,amd64 +// +build freebsd package ps diff --git a/process_unix.go b/process_unix.go index 3b733ce..cd217a8 100644 --- a/process_unix.go +++ b/process_unix.go @@ -56,7 +56,7 @@ func processes() ([]Process, error) { results := make([]Process, 0, 50) for { - fis, err := d.Readdir(10) + names, err := d.Readdirnames(10) if err == io.EOF { break } @@ -64,14 +64,8 @@ func processes() ([]Process, error) { return nil, err } - for _, fi := range fis { - // We only care about directories, since all pids are dirs - if !fi.IsDir() { - continue - } - + for _, name := range names { // We only care if the name starts with a numeric - name := fi.Name() if name[0] < '0' || name[0] > '9' { continue }