mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-26 13:48:59 +08:00
change test pid if windows
This commit is contained in:
parent
64add546a4
commit
a1cad298ab
@ -3,6 +3,7 @@ package gopsutil
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -17,7 +18,12 @@ func Test_Pids(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_Pid_exists(t *testing.T) {
|
||||
ret, err := Pid_exists(1)
|
||||
check_pid := 1
|
||||
if runtime.GOOS == "windows" {
|
||||
check_pid = 0
|
||||
}
|
||||
|
||||
ret, err := Pid_exists(int32(check_pid))
|
||||
if err != nil {
|
||||
t.Errorf("error %v", err)
|
||||
}
|
||||
@ -28,7 +34,12 @@ func Test_Pid_exists(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_NewProcess(t *testing.T) {
|
||||
ret, err := NewProcess(1)
|
||||
check_pid := 1
|
||||
if runtime.GOOS == "windows" {
|
||||
check_pid = 0
|
||||
}
|
||||
|
||||
ret, err := NewProcess(int32(check_pid))
|
||||
if err != nil {
|
||||
t.Errorf("error %v", err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user