Skip to content

Commit b8275de

Browse files
committed
windows: export getProcessEntry
This function is currently copied in github.com/inconshreveable/mousetrap, which is widely used in projects (commonly as dependency for spf13/cobra). Until recently, mousetrap had code for backward-compatibility with old Go versions, but now that that code was removed, it's a very small wrapper around getProcessEntry. Exporting this function allows it to be an even smaller wrapper (most projects would already have golang.org/x/sys as dependency in some form or another).
1 parent 3b1fc93 commit b8275de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

windows/syscall_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ func FindNextFile(handle Handle, data *Win32finddata) (err error) {
13901390
return
13911391
}
13921392

1393-
func getProcessEntry(pid int) (*ProcessEntry32, error) {
1393+
func GetProcessEntry(pid int) (*ProcessEntry32, error) {
13941394
snapshot, err := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
13951395
if err != nil {
13961396
return nil, err
@@ -1413,7 +1413,7 @@ func getProcessEntry(pid int) (*ProcessEntry32, error) {
14131413
}
14141414

14151415
func Getppid() (ppid int) {
1416-
pe, err := getProcessEntry(Getpid())
1416+
pe, err := GetProcessEntry(Getpid())
14171417
if err != nil {
14181418
return -1
14191419
}

0 commit comments

Comments
 (0)