fix(launcher): start-hidden.vbs must be ASCII + CRLF, use python.exe
Lint & Test / test (push) Successful in 1m40s
Lint & Test / test (push) Successful in 1m40s
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user