mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-05 07:56:50 +08:00
add event
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/google/shlex"
|
||||
"github.com/lzh-1625/go_process_manager/config"
|
||||
"github.com/lzh-1625/go_process_manager/internal/app/constants"
|
||||
"github.com/lzh-1625/go_process_manager/internal/app/eum"
|
||||
"github.com/lzh-1625/go_process_manager/internal/app/model"
|
||||
"github.com/lzh-1625/go_process_manager/log"
|
||||
"github.com/lzh-1625/go_process_manager/utils"
|
||||
@@ -26,19 +26,19 @@ func (p *ProcessPty) doOnKilled() {
|
||||
p.pty.Close()
|
||||
}
|
||||
|
||||
func (p *ProcessPty) Type() constants.TerminalType {
|
||||
return constants.TERMINAL_PTY
|
||||
func (p *ProcessPty) Type() eum.TerminalType {
|
||||
return eum.TerminalPty
|
||||
}
|
||||
|
||||
func (p *ProcessPty) Start() (err error) {
|
||||
defer func() {
|
||||
if err != nil {
|
||||
p.Config.AutoRestart = false
|
||||
p.SetState(constants.PROCESS_WARNNING)
|
||||
p.SetState(eum.ProcessStateWarnning)
|
||||
p.State.Info = "进程启动失败:" + err.Error()
|
||||
}
|
||||
}()
|
||||
if ok := p.SetState(constants.PROCESS_START, func() bool {
|
||||
if ok := p.SetState(eum.ProcessStateStart, func() bool {
|
||||
return p.State.State != 1
|
||||
}); !ok {
|
||||
log.Logger.Warnw("进程已在运行,跳过启动")
|
||||
|
Reference in New Issue
Block a user