2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 06:40:59 +08:00

fix: cli下安装应用

This commit is contained in:
耗子
2024-10-17 12:39:12 +08:00
parent 8cb74159f2
commit 7cb497929b
2 changed files with 26 additions and 12 deletions

View File

@@ -80,3 +80,13 @@ func ExecfWithTimeout(timeout time.Duration, shell string, args ...any) (string,
return strings.TrimSpace(stdout.String()), err
}
// ExecfWithOutput 执行 shell 命令并输出到终端
func ExecfWithOutput(shell string, args ...any) error {
_ = os.Setenv("LC_ALL", "C")
cmd := exec.Command("bash", "-c", fmt.Sprintf(shell, args...))
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}