From 9b5ea3f317a8060acb92f9e63e8a20764c55e252 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Tue, 6 Dec 2022 15:59:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=A4=B1=E8=B4=A5=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app_install.go | 2 +- backend/utils/compose/compose.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/app/service/app_install.go b/backend/app/service/app_install.go index 23e58c2da..8063aa15c 100644 --- a/backend/app/service/app_install.go +++ b/backend/app/service/app_install.go @@ -129,7 +129,7 @@ func (a AppInstallService) Operate(req dto.AppInstallOperate) error { } install.Status = constant.Running case dto.Down: - out, err := compose.Down(dockerComposePath) + out, err := compose.Stop(dockerComposePath) if err != nil { return handleErr(install, err, out) } diff --git a/backend/utils/compose/compose.go b/backend/utils/compose/compose.go index 2362db7f2..57c5fb8ac 100644 --- a/backend/utils/compose/compose.go +++ b/backend/utils/compose/compose.go @@ -13,6 +13,12 @@ func Up(filePath string) (string, error) { } func Down(filePath string) (string, error) { + cmd := exec.Command("docker-compose", "-f", filePath, "down") + stdout, err := cmd.CombinedOutput() + return string(stdout), err +} + +func Stop(filePath string) (string, error) { cmd := exec.Command("docker-compose", "-f", filePath, "stop") stdout, err := cmd.CombinedOutput() return string(stdout), err