Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(125)

Side by Side Diff: src/pkg/os/exec_unix.go

Issue 3749041: code review 3749041: os/signal: selective signal handling (Closed)
Patch Set: diff -r 1f2a839158ce https://go.googlecode.com/hg/ Created 13 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build darwin freebsd linux netbsd openbsd 5 // +build darwin freebsd linux netbsd openbsd
6 6
7 package os 7 package os
8 8
9 import ( 9 import (
10 "errors" 10 "errors"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 w.WaitStatus = status 50 w.WaitStatus = status
51 w.Rusage = rusage 51 w.Rusage = rusage
52 return w, nil 52 return w, nil
53 } 53 }
54 54
55 // Signal sends a signal to the Process. 55 // Signal sends a signal to the Process.
56 func (p *Process) Signal(sig Signal) error { 56 func (p *Process) Signal(sig Signal) error {
57 if p.done { 57 if p.done {
58 return errors.New("os: process already finished") 58 return errors.New("os: process already finished")
59 } 59 }
60 » if e := syscall.Kill(p.Pid, int(sig.(UnixSignal))); e != nil { 60 » if e := syscall.Kill(p.Pid, sig.(syscall.Signal)); e != nil {
bradfitz 2012/02/09 00:23:35 can we comma-ok assert the type and return an erro
rsc1 2012/02/10 23:08:44 Done.
61 return e 61 return e
62 } 62 }
63 return nil 63 return nil
64 } 64 }
65 65
66 // Release releases any resources associated with the Process. 66 // Release releases any resources associated with the Process.
67 func (p *Process) Release() error { 67 func (p *Process) Release() error {
68 // NOOP for unix. 68 // NOOP for unix.
69 p.Pid = -1 69 p.Pid = -1
70 // no need for a finalizer anymore 70 // no need for a finalizer anymore
71 runtime.SetFinalizer(p, nil) 71 runtime.SetFinalizer(p, nil)
72 return nil 72 return nil
73 } 73 }
74 74
75 func findProcess(pid int) (p *Process, err error) { 75 func findProcess(pid int) (p *Process, err error) {
76 // NOOP for unix. 76 // NOOP for unix.
77 return newProcess(pid, 0), nil 77 return newProcess(pid, 0), nil
78 } 78 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b