OSDN Git Service

add package
[bytom/vapor.git] / vendor / github.com / hashicorp / go-plugin / process_windows.go
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 }