From 53e0ba025cb43b049e17c4b46a86e83fbbab5580 Mon Sep 17 00:00:00 2001 From: jim800121chen Date: Mon, 9 Mar 2026 19:04:08 +0800 Subject: [PATCH] fix: Windows installer server launch and auto-start issues - Remove --tray flag from LaunchServer() on Windows (notray build) - Switch schtasks from PowerShell Register-ScheduledTask to schtasks CLI for Chinese Windows compatibility - Remove /RL HIGHEST from schtasks (requires admin privileges) - Add install log output to %TEMP%/edgeai-install.log - Add critical flag to install steps (critical failures abort) - Fix extractDir: create parent dirs before writing files - Improve findPython3: skip Windows Store stub, auto-install via winget - Enhance installLibusb: extract bundled DLL, fallback to winget Co-Authored-By: Claude Opus 4.6 --- edge-ai-platform/installer/app.go | 7 ++++++- edge-ai-platform/installer/platform_windows.go | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/edge-ai-platform/installer/app.go b/edge-ai-platform/installer/app.go index 4934b32..97adb53 100644 --- a/edge-ai-platform/installer/app.go +++ b/edge-ai-platform/installer/app.go @@ -614,7 +614,12 @@ func (inst *Installer) LaunchServer() (string, error) { binPath := filepath.Join(installDir, binName) // Read config to get relay args - args := []string{"--tray"} + // Note: on Windows the server is built with CGO_ENABLED=0 -tags notray, + // so --tray is not available. On macOS the tray-enabled build is used. + var args []string + if runtime.GOOS != "windows" { + args = append(args, "--tray") + } cfgPath := filepath.Join(platformConfigDir(), "config.json") if data, err := os.ReadFile(cfgPath); err == nil { var cfg map[string]interface{} diff --git a/edge-ai-platform/installer/platform_windows.go b/edge-ai-platform/installer/platform_windows.go index 5bc9875..780e9de 100644 --- a/edge-ai-platform/installer/platform_windows.go +++ b/edge-ai-platform/installer/platform_windows.go @@ -137,11 +137,11 @@ func installAutoRestart(installDir string) error { // Use schtasks instead of PowerShell Register-ScheduledTask // to avoid XML parsing issues on non-English Windows + // Note: do not use /RL HIGHEST — it requires admin privileges cmd := exec.Command("schtasks", "/Create", "/TN", taskName, - "/TR", fmt.Sprintf(`"%s" --tray`, binPath), + "/TR", fmt.Sprintf(`"%s"`, binPath), "/SC", "ONLOGON", - "/RL", "HIGHEST", "/F", ) if out, err := cmd.CombinedOutput(); err != nil {