From fc8ee3436967fcf08128a9ebd3b17685beca30a7 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Wed, 8 Apr 2026 00:15:49 +0300 Subject: [PATCH] fix(launcher): start-hidden.vbs must be ASCII + CRLF, use python.exe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three separate bugs in the VBS launcher wedged together: 1. The previous fix added a UTF-8 em-dash in a comment. wscript.exe on Windows refused to execute the file with "Execution of the Windows Script Host failed. (Not enough memory resources are available to complete this operation.)" — a misleading error that actually means "I could not parse this file as ANSI VBScript". Fix: keep the file pure ASCII, convert to CRLF. 2. The launcher was invoking pythonw.exe. WshShell.Run spawning pythonw.exe inside the wscript host exited immediately (no process, no log). python.exe with WindowStyle=0 works reliably and matches the pattern used by the Media Server sibling app's VBS launcher, which has been running on this machine without issue. 3. The env vars (PYTHONPATH, WLED_CONFIG_PATH) must be set before the child process spawns, otherwise config.py falls back to the CWD default path that does not exist at install time. --- server/scripts/start-hidden.vbs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/server/scripts/start-hidden.vbs b/server/scripts/start-hidden.vbs index 6448bea..5932d82 100644 --- a/server/scripts/start-hidden.vbs +++ b/server/scripts/start-hidden.vbs @@ -1,25 +1,18 @@ -' Launch wled_controller silently (no console, no window). -' Used by the Start Menu / autostart / desktop shortcut created by the -' NSIS installer. Must set the same env vars as LedGrab.bat, otherwise -' the server runs with built-in defaults (wrong config path, wrong data -' dir) and the UI appears to be unconfigured on every startup. - Set fso = CreateObject("Scripting.FileSystemObject") Set WshShell = CreateObject("WScript.Shell") - ' Get the directory of this script (scripts\), then go up to app root scriptDir = fso.GetParentFolderName(WScript.ScriptFullName) appRoot = fso.GetParentFolderName(scriptDir) WshShell.CurrentDirectory = appRoot -' Set environment variables for the child process. WshShell.Environment("Process") -' is writable and child processes spawned via Run inherit it. +' Set env vars for the child process (inherited via WshShell.Run) Set procEnv = WshShell.Environment("Process") procEnv("PYTHONPATH") = appRoot & "\app\src" procEnv("WLED_CONFIG_PATH") = appRoot & "\app\config\default_config.yaml" -' Use embedded Python if present (installed dist), otherwise system Python -embeddedPython = appRoot & "\python\pythonw.exe" +' Use embedded python.exe (NOT pythonw.exe) with WindowStyle=0. +' Same pattern as the Media Server sibling app. +embeddedPython = appRoot & "\python\python.exe" If fso.FileExists(embeddedPython) Then WshShell.Run """" & embeddedPython & """ -m wled_controller", 0, False Else