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