mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-10 10:20:18 +08:00
edit process kill
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
@@ -320,6 +321,10 @@ func (p *ProcessBase) initPsutil() {
|
||||
}
|
||||
|
||||
func (p *ProcessBase) Kill() error {
|
||||
if p.State.State != eum.ProcessStateRunning {
|
||||
return errors.New("can't kill not running process")
|
||||
}
|
||||
p.State.manualStopFlag = true
|
||||
p.op.Signal(syscall.SIGINT)
|
||||
select {
|
||||
case <-p.StopChan:
|
||||
|
Reference in New Issue
Block a user