Skip to content

Commit 1458000

Browse files
committed
checks if machine has exited and error on PID function
1 parent a1cfb79 commit 1458000

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

machine.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ func (m *Machine) PID() (int, error) {
168168
if m.cmd == nil || m.cmd.Process == nil {
169169
return 0, fmt.Errorf("machine is not running")
170170
}
171+
select {
172+
case <-m.exitCh:
173+
return 0, fmt.Errorf("machine process has exited")
174+
default:
175+
}
171176
return m.cmd.Process.Pid, nil
172177
}
173178

0 commit comments

Comments
 (0)