Skip to content

Commit

Permalink
update windows style
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Feb 7, 2016
1 parent 13508a5 commit 2ad7b2b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions process_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ import (
"syscall"
)

const STILL_ACTIVE = 259
const (
// Weird name but matches the MSDN docs
exit_STILL_ACTIVE = 259

// _pidAlive tests whether a process is alive or not
func _pidAlive(pid int) bool {
const da = syscall.STANDARD_RIGHTS_READ |
processDesiredAccess = syscall.STANDARD_RIGHTS_READ |
syscall.PROCESS_QUERY_INFORMATION |
syscall.SYNCHRONIZE
h, e := syscall.OpenProcess(da, false, uint32(pid))
if e != nil {
)

// _pidAlive tests whether a process is alive or not
func _pidAlive(pid int) bool {
h, err := syscall.OpenProcess(processDesiredAccess, false, uint32(pid))
if err != nil {
return false
}

Expand All @@ -23,5 +27,5 @@ func _pidAlive(pid int) bool {
return false
}

return ec == STILL_ACTIVE
return ec == exit_STILL_ACTIVE
}

0 comments on commit 2ad7b2b

Please sign in to comment.