From 7e229c05e75756c07d1b959503d9cf31df20dd1f Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Tue, 12 Aug 2025 11:20:45 +0800 Subject: [PATCH] fix: Fix clamdscan timeout issues (#9961) Refs #9626 --- agent/app/service/clam.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/agent/app/service/clam.go b/agent/app/service/clam.go index 62c9b1edd..ee1597527 100644 --- a/agent/app/service/clam.go +++ b/agent/app/service/clam.go @@ -3,7 +3,6 @@ package service import ( "bufio" "fmt" - "github.com/1Panel-dev/1Panel/agent/utils/alert_push" "os" "os/exec" "path" @@ -12,13 +11,13 @@ import ( "strings" "time" - "github.com/1Panel-dev/1Panel/agent/app/repo" - "github.com/1Panel-dev/1Panel/agent/app/dto" "github.com/1Panel-dev/1Panel/agent/app/model" + "github.com/1Panel-dev/1Panel/agent/app/repo" "github.com/1Panel-dev/1Panel/agent/buserr" "github.com/1Panel-dev/1Panel/agent/constant" "github.com/1Panel-dev/1Panel/agent/global" + "github.com/1Panel-dev/1Panel/agent/utils/alert_push" "github.com/1Panel-dev/1Panel/agent/utils/cmd" "github.com/1Panel-dev/1Panel/agent/utils/common" "github.com/1Panel-dev/1Panel/agent/utils/systemctl" @@ -345,7 +344,7 @@ func (c *ClamService) HandleOnce(req dto.OperateByID) error { } } global.LOG.Debugf("clamdscan --fdpass %s %s -l %s", strategy, clam.Path, logFile) - stdout, err := cmd.RunDefaultWithStdoutBashCf("clamdscan --fdpass %s %s -l %s", strategy, clam.Path, logFile) + stdout, err := cmd.NewCommandMgr(cmd.WithIgnoreExist1(), cmd.WithTimeout(30*time.Minute)).RunWithStdoutBashCf("clamdscan --fdpass %s %s -l %s", strategy, clam.Path, logFile) if err != nil { global.LOG.Errorf("clamdscan failed, stdout: %v, err: %v", stdout, err) }