File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ func (e *execProcess) setExited(status int) {
8989 e .status = status
9090 e .exited = time .Now ()
9191 e .parent .platform .ShutdownConsole (context .Background (), e .console )
92+ e .pid = - 1
9293 close (e .waitBlock )
9394}
9495
@@ -115,7 +116,7 @@ func (e *execProcess) resize(ws console.WinSize) error {
115116
116117func (e * execProcess ) kill (ctx context.Context , sig uint32 , _ bool ) error {
117118 pid := e .pid
118- if pid != 0 {
119+ if pid > 0 {
119120 if err := unix .Kill (pid , syscall .Signal (sig )); err != nil {
120121 return errors .Wrapf (checkKillError (err ), "exec kill error" )
121122 }
@@ -212,10 +213,14 @@ func (e *execProcess) Status(ctx context.Context) (string, error) {
212213 }
213214 e .mu .Lock ()
214215 defer e .mu .Unlock ()
215- // if we don't have a pid then the exec process has just been created
216+ // if we don't have a pid(pid=0) then the exec process has just been created
216217 if e .pid == 0 {
217218 return "created" , nil
218219 }
220+ // if we have a pid=-1 then the exec process has just been stopped
221+ if e .pid == - 1 {
222+ return "stopped" , nil
223+ }
219224 // if we have a pid and it can be signaled, the process is running
220225 if err := unix .Kill (e .pid , 0 ); err == nil {
221226 return "running" , nil
You can’t perform that action at this time.
0 commit comments