From 665ddbd7c36baed2a315ca1ab3da7a660fc34c4c Mon Sep 17 00:00:00 2001 From: WAKAYAMA Shirou Date: Fri, 25 Apr 2014 22:26:22 +0900 Subject: [PATCH] add signal test stub on windows. and move to signal test process_test_posix --- process_test.go | 12 ------------ process_test_posix.go | 19 +++++++++++++++++++ process_windows.go | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 process_test_posix.go diff --git a/process_test.go b/process_test.go index 6be9165..1366f91 100644 --- a/process_test.go +++ b/process_test.go @@ -6,7 +6,6 @@ import ( "os" "runtime" "testing" - "syscall" ) 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) - } -} diff --git a/process_test_posix.go b/process_test_posix.go new file mode 100644 index 0000000..75e9223 --- /dev/null +++ b/process_test_posix.go @@ -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) + } +} diff --git a/process_windows.go b/process_windows.go index 901ca8c..2b53816 100644 --- a/process_windows.go +++ b/process_windows.go @@ -85,6 +85,22 @@ func NewProcess(pid int32) (*Process, error) { 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 { p.Ppid = int32(pe32.Th32ParentProcessID)