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:
commit
fc800d3fb4
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user