fix silent windows

This commit is contained in:
KingKDot
2026-04-06 18:20:52 -05:00
parent 22fad89699
commit d998aa9c7f
3 changed files with 11 additions and 0 deletions
@@ -57,6 +57,8 @@ func HandleScriptExecute(ctx context.Context, env *agentRuntime.Env, cmdID strin
}) })
} }
hideCmdWindow(cmd)
timeout := 5 * time.Minute timeout := 5 * time.Minute
ctx, cancel := context.WithTimeout(ctx, timeout) ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel() defer cancel()
@@ -10,6 +10,8 @@ import (
"strings" "strings"
) )
func hideCmdWindow(_ *exec.Cmd) {}
func startSilentProcess(command string, args []string, cwd string, _ bool) error { func startSilentProcess(command string, args []string, cwd string, _ bool) error {
ext := strings.ToLower(filepath.Ext(command)) ext := strings.ToLower(filepath.Ext(command))
@@ -13,6 +13,13 @@ import (
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )
func hideCmdWindow(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{
HideWindow: true,
CreationFlags: windows.CREATE_NO_WINDOW,
}
}
func startSilentProcess(command string, args []string, cwd string, hideWindow bool) error { func startSilentProcess(command string, args []string, cwd string, hideWindow bool) error {
ext := strings.ToLower(filepath.Ext(command)) ext := strings.ToLower(filepath.Ext(command))