mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-29 13:49:21 +08:00
add signal test stub on windows. and move to signal test process_test_posix
This commit is contained in:
parent
d1b1221e7f
commit
665ddbd7c3
@ -6,7 +6,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_Pids(t *testing.T) {
|
func Test_Pids(t *testing.T) {
|
||||||
@ -66,14 +65,3 @@ func Test_Process_memory_maps(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func Test_SendSignal(t *testing.T){
|
|
||||||
check_pid := os.Getpid()
|
|
||||||
|
|
||||||
p, _ := NewProcess(int32(check_pid))
|
|
||||||
err := p.Send_signal(syscall.SIGCONT)
|
|
||||||
if err != nil{
|
|
||||||
t.Errorf("send signal %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
19
process_test_posix.go
Normal file
19
process_test_posix.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// +build linux freebsd
|
||||||
|
|
||||||
|
package gopsutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test_SendSignal(t *testing.T) {
|
||||||
|
check_pid := os.Getpid()
|
||||||
|
|
||||||
|
p, _ := NewProcess(int32(check_pid))
|
||||||
|
err := p.Send_signal(syscall.SIGCONT)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("send signal %v", err)
|
||||||
|
}
|
||||||
|
}
|
@ -85,6 +85,22 @@ func NewProcess(pid int32) (*Process, error) {
|
|||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Process) Send_signal(sig syscall.Signal) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Process) Suspend() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (p *Process) Resume() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (p *Process) Terminate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (p *Process) Kill() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func copy_params(pe32 *PROCESSENTRY32, p *Process) error {
|
func copy_params(pe32 *PROCESSENTRY32, p *Process) error {
|
||||||
p.Ppid = int32(pe32.Th32ParentProcessID)
|
p.Ppid = int32(pe32.Th32ParentProcessID)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user