From 88c3559245a4da0e1eb394c089e14e542af65ce9 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 16 Nov 2023 14:42:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E6=9F=90=E4=BA=9B=E8=AE=BE=E7=BD=AE=E4=BC=9A=E6=8A=A5=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E5=86=85=E9=83=A8=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#2973)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs https://github.com/1Panel-dev/1Panel/issues/2955 --- backend/app/service/nginx_utils.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/app/service/nginx_utils.go b/backend/app/service/nginx_utils.go index 1478ef660..b2ff28c83 100644 --- a/backend/app/service/nginx_utils.go +++ b/backend/app/service/nginx_utils.go @@ -196,8 +196,11 @@ func opNginx(containerName, operate string) error { if operate == constant.NginxCheck { nginxCmd = fmt.Sprintf("docker exec -i %s %s", containerName, "nginx -t") } - if out, err := cmd.ExecWithTimeOut(nginxCmd, 2*time.Second); err != nil { - return errors.New(out) + if out, err := cmd.ExecWithTimeOut(nginxCmd, 20*time.Second); err != nil { + if out != "" { + return errors.New(out) + } + return err } return nil }