Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Jan 24, 2024
1 parent 9da2b34 commit 0246eb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions application/library/config/cliconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (c *CLIConfig) CmdGroupStop(groupName string) error {
continue
}
err := c.Kill(cmd)
if err != nil && !errors.Is(err, os.ErrProcessDone) {
if err != nil {
log.Errorf(`failed to %v.Kill: %v`, key, err)
}
}
Expand Down Expand Up @@ -215,9 +215,6 @@ func (c *CLIConfig) CmdStop(typeName string) error {
}
err := c.Kill(cmd)
if err != nil {
if errors.Is(err, os.ErrProcessDone) {
return nil
}
err = fmt.Errorf(`failed to cliconfig.CmdStop(%q): %v`, typeName, err)
}
return err
Expand Down
4 changes: 3 additions & 1 deletion application/library/cron/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ package cron

import (
"context"
"errors"
"fmt"
"os"
"os/exec"
"time"

Expand Down Expand Up @@ -82,7 +84,7 @@ func runCmdWithTimeout(cmd *exec.Cmd, timeout time.Duration, ctx context.Context
go func() {
<-done // 读出上面的goroutine数据,避免阻塞导致无法退出
}()
if err = cmd.Process.Kill(); err != nil {
if err = cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) {
log.Errorf("进程[%d]无法关闭, 错误信息: %s", cmd.Process.Pid, err)
}
}
Expand Down

0 comments on commit 0246eb0

Please sign in to comment.