diff options
Diffstat (limited to 'vendor/github.com/hashicorp/go-plugin/process_windows.go')
-rw-r--r-- | vendor/github.com/hashicorp/go-plugin/process_windows.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-plugin/process_windows.go b/vendor/github.com/hashicorp/go-plugin/process_windows.go new file mode 100644 index 0000000..9f7b018 --- /dev/null +++ b/vendor/github.com/hashicorp/go-plugin/process_windows.go | |||
@@ -0,0 +1,29 @@ | |||
1 | package plugin | ||
2 | |||
3 | import ( | ||
4 | "syscall" | ||
5 | ) | ||
6 | |||
7 | const ( | ||
8 | // Weird name but matches the MSDN docs | ||
9 | exit_STILL_ACTIVE = 259 | ||
10 | |||
11 | processDesiredAccess = syscall.STANDARD_RIGHTS_READ | | ||
12 | syscall.PROCESS_QUERY_INFORMATION | | ||
13 | syscall.SYNCHRONIZE | ||
14 | ) | ||
15 | |||
16 | // _pidAlive tests whether a process is alive or not | ||
17 | func _pidAlive(pid int) bool { | ||
18 | h, err := syscall.OpenProcess(processDesiredAccess, false, uint32(pid)) | ||
19 | if err != nil { | ||
20 | return false | ||
21 | } | ||
22 | |||
23 | var ec uint32 | ||
24 | if e := syscall.GetExitCodeProcess(h, &ec); e != nil { | ||
25 | return false | ||
26 | } | ||
27 | |||
28 | return ec == exit_STILL_ACTIVE | ||
29 | } | ||