aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec.go
diff options
context:
space:
mode:
authorMoritz Poldrack <git@moritz.sh>2023-06-16 21:12:25 +0000
committerGopher Robot <gobot@golang.org>2023-06-17 19:02:45 +0000
commit261e26761805e03c126bf3934a8f39302e8d85fb (patch)
treed9949dc760616b29fcd47850976a45d0467dcecc /src/os/exec.go
parentdbf9bf2c39116f1330002ebba8f8870b96645d87 (diff)
downloadgo-261e26761805e03c126bf3934a8f39302e8d85fb.tar.xz
os/exec: document a method to check if a process is alive
Fixes #34396 Change-Id: I35c4e3447f84e349adf7edba92ccb19b324bfe14 GitHub-Last-Rev: 4f06764109ddd9bdfbe4841fc1bebebe026eeb29 GitHub-Pull-Request: golang/go#60763 Reviewed-on: https://go-review.googlesource.com/c/go/+/502815 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/os/exec.go')
-rw-r--r--src/os/exec.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/os/exec.go b/src/os/exec.go
index d01ca592ba..ed5a75c4d1 100644
--- a/src/os/exec.go
+++ b/src/os/exec.go
@@ -86,7 +86,9 @@ func Getppid() int { return syscall.Getppid() }
// about the underlying operating system process.
//
// On Unix systems, FindProcess always succeeds and returns a Process
-// for the given pid, regardless of whether the process exists.
+// for the given pid, regardless of whether the process exists. To test whether
+// the process actually exists, see whether p.Signal(syscall.Signal(0)) reports
+// an error.
func FindProcess(pid int) (*Process, error) {
return findProcess(pid)
}