Skip to content

Commit b930fe2

Browse files
committed
os: add ExitCode() method to ProcessState
1 parent 48c7973 commit b930fe2

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/os/exec_plan9.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,8 @@ func (p *ProcessState) String() string {
136136
}
137137
return "exit status: " + p.status.Msg
138138
}
139+
140+
// ExitCode return the exit code of a finished process.
141+
func (p *ProcessState) ExitCode() int {
142+
return p.status.ExitStatus()
143+
}

src/os/exec_posix.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,8 @@ func (p *ProcessState) String() string {
106106
}
107107
return res
108108
}
109+
110+
// ExitCode return the exit code of a finished process.
111+
func (p *ProcessState) ExitCode() int {
112+
return p.status.ExitStatus()
113+
}

0 commit comments

Comments
 (0)