mirror of
https://github.com/golang/go.git
synced 2025-11-08 12:41:02 +00:00
parent
c06cf03f0b
commit
08a073a180
30 changed files with 233 additions and 253 deletions
|
|
@ -7,6 +7,7 @@
|
|||
package os
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"runtime"
|
||||
"syscall"
|
||||
)
|
||||
|
|
@ -24,9 +25,9 @@ const (
|
|||
// the options
|
||||
|
||||
// Wait waits for the Process to exit or stop, and then returns a
|
||||
// Waitmsg describing its status and an Error, if any. The options
|
||||
// Waitmsg describing its status and an error, if any. The options
|
||||
// (WNOHANG etc.) affect the behavior of the Wait call.
|
||||
func (p *Process) Wait(options int) (w *Waitmsg, err Error) {
|
||||
func (p *Process) Wait(options int) (w *Waitmsg, err error) {
|
||||
if p.Pid == -1 {
|
||||
return nil, EINVAL
|
||||
}
|
||||
|
|
@ -52,9 +53,9 @@ func (p *Process) Wait(options int) (w *Waitmsg, err Error) {
|
|||
}
|
||||
|
||||
// Signal sends a signal to the Process.
|
||||
func (p *Process) Signal(sig Signal) Error {
|
||||
func (p *Process) Signal(sig Signal) error {
|
||||
if p.done {
|
||||
return NewError("os: process already finished")
|
||||
return errors.New("os: process already finished")
|
||||
}
|
||||
if e := syscall.Kill(p.Pid, int(sig.(UnixSignal))); e != 0 {
|
||||
return Errno(e)
|
||||
|
|
@ -63,7 +64,7 @@ func (p *Process) Signal(sig Signal) Error {
|
|||
}
|
||||
|
||||
// Release releases any resources associated with the Process.
|
||||
func (p *Process) Release() Error {
|
||||
func (p *Process) Release() error {
|
||||
// NOOP for unix.
|
||||
p.Pid = -1
|
||||
// no need for a finalizer anymore
|
||||
|
|
@ -74,7 +75,7 @@ func (p *Process) Release() Error {
|
|||
// FindProcess looks for a running process by its pid.
|
||||
// The Process it returns can be used to obtain information
|
||||
// about the underlying operating system process.
|
||||
func FindProcess(pid int) (p *Process, err Error) {
|
||||
func FindProcess(pid int) (p *Process, err error) {
|
||||
// NOOP for unix.
|
||||
return newProcess(pid, 0), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue