-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
ferrmin/go
#645Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version)?
$go version go1.12.6 linux/amd64
Does this issue reproduce with the latest release?
Yes, Documentation issue, see live doc at:
https://golang.org/pkg/os/#FindProcess
What operating system and processor architecture are you using (go env)?
go env Output
$ go env $ go env GOARCH="amd64" GOHOSTARCH="amd64" GOHOSTOS="linux"
What did you do?
Tried to find out if a process exists using os.FindProcess()
Read the documentation to find that the FindProcess call always returns a nil error on unix systems so it doesn't really "find" the process:
On Unix systems, FindProcess always succeeds and returns a Process for the given pid, regardless of whether the process exists.
Found closed documentation ticket saying you can send a signal to find if the process really exists or not:
What did you expect to see?
More helpful information in the documentation about how someone might actually test for a process existing, for example as a starter on Linux:
// error is always nil on Unix systems, just creates a process object
p, _ := os.FindProcess(pid)
// send SIGCONT (on Linux) which is a safe signal to the process to test if it exists
err = p.Signal(syscall.SIGCONT)
What did you see instead?
No help without how the user might find out that a process really exists. Just a comment that it doesn't actually tell you if the process exists:
On Unix systems, FindProcess always succeeds and returns a Process for the given pid, regardless of whether the process exists.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.