1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-26 13:48:59 +08:00

Merge pull request #267 from botherder/master

Added Terminate() for Windows
This commit is contained in:
shirou 2016-10-12 00:28:17 +09:00 committed by GitHub
commit fc800d3fb4

View File

@ -308,9 +308,20 @@ func (p *Process) Suspend() error {
func (p *Process) Resume() error {
return common.ErrNotImplementedError
}
func (p *Process) Terminate() error {
return common.ErrNotImplementedError
// PROCESS_TERMINATE = 0x0001
proc := w32.OpenProcess(0x0001, false, uint32(p.Pid))
ret := w32.TerminateProcess(proc, 0)
w32.CloseHandle(proc)
if ret == false {
return syscall.GetLastError()
} else {
return nil
}
}
func (p *Process) Kill() error {
return common.ErrNotImplementedError
}