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

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

Issue 5688046: code review 5688046: os: drop the Wait function and the options to Process.Wait (Closed)
Patch Set: diff -r c76997f376a5 https://code.google.com/p/go 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
« no previous file with comments | « src/pkg/os/exec_plan9.go ('k') | src/pkg/os/exec_unix.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 windows 5 // +build darwin freebsd linux netbsd openbsd windows
6 6
7 package os 7 package os
8 8
9 import ( 9 import (
10 "syscall" 10 "syscall"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // different OS. 50 // different OS.
51 51
52 // Waitmsg stores the information about an exited process as reported by Wait. 52 // Waitmsg stores the information about an exited process as reported by Wait.
53 type Waitmsg struct { 53 type Waitmsg struct {
54 Pid int // The process's id. 54 Pid int // The process's id.
55 syscall.WaitStatus // System-dependent status info. 55 syscall.WaitStatus // System-dependent status info.
56 Rusage *syscall.Rusage // System-dependent resource usage in fo. 56 Rusage *syscall.Rusage // System-dependent resource usage in fo.
57 } 57 }
58 58
59 // Wait waits for process pid to exit or stop, and then returns a 59 // Wait waits for process pid to exit or stop, and then returns a
60 // Waitmsg describing its status and an error, if any. The options 60 // Waitmsg describing its status and an error, if any.
61 // (WNOHANG etc.) affect the behavior of the Wait call.
62 // Wait is equivalent to calling FindProcess and then Wait 61 // Wait is equivalent to calling FindProcess and then Wait
63 // and Release on the result. 62 // and Release on the result.
64 func Wait(pid int, options int) (w *Waitmsg, err error) { 63 func Wait(pid int) (w *Waitmsg, err error) {
65 p, e := FindProcess(pid) 64 p, e := FindProcess(pid)
66 if e != nil { 65 if e != nil {
67 return nil, e 66 return nil, e
68 } 67 }
69 defer p.Release() 68 defer p.Release()
70 » return p.Wait(options) 69 » return p.Wait()
71 } 70 }
72 71
73 // Convert i to decimal string. 72 // Convert i to decimal string.
74 func itod(i int) string { 73 func itod(i int) string {
75 if i == 0 { 74 if i == 0 {
76 return "0" 75 return "0"
77 } 76 }
78 77
79 u := uint64(i) 78 u := uint64(i)
80 if i < 0 { 79 if i < 0 {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 res += " (trap " + itod(w.TrapCause()) + ")" 113 res += " (trap " + itod(w.TrapCause()) + ")"
115 } 114 }
116 case w.Continued(): 115 case w.Continued():
117 res = "continued" 116 res = "continued"
118 } 117 }
119 if w.CoreDump() { 118 if w.CoreDump() {
120 res += " (core dumped)" 119 res += " (core dumped)"
121 } 120 }
122 return res 121 return res
123 } 122 }
OLDNEW
« no previous file with comments | « src/pkg/os/exec_plan9.go ('k') | src/pkg/os/exec_unix.go » ('j') | no next file with comments »

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