Skip to content

Commit

Permalink
#118: Process.isRunning is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
stou committed Jan 26, 2019
1 parent c6e9d46 commit df96aae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"os/exec"
"os/user"
"runtime"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -327,7 +328,12 @@ func (p *Process) getExitCodes() []int {
//
func (p *Process) isRunning() bool {
if p.cmd != nil && p.cmd.ProcessState != nil {
return p.cmd.Process.Signal( syscall.Signal( 0 ) ) == nil
if runtime.GOOS == "windows" {
proc, err := os.FindProcess( p.cmd.Process.Pid )
return proc != nil && err == nil
} else {
return p.cmd.Process.Signal( syscall.Signal( 0 ) ) == nil
}
}
return false
}
Expand Down

0 comments on commit df96aae

Please sign in to comment.