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 fso = CreateObject("Scripting.FileSystemObject")
|
||||||
Set WshShell = CreateObject("WScript.Shell")
|
Set WshShell = CreateObject("WScript.Shell")
|
||||||
|
|
||||||
' Get the directory of this script (scripts\), then go up to app root
|
' Get the directory of this script (scripts\), then go up to app root
|
||||||
scriptDir = fso.GetParentFolderName(WScript.ScriptFullName)
|
scriptDir = fso.GetParentFolderName(WScript.ScriptFullName)
|
||||||
appRoot = fso.GetParentFolderName(scriptDir)
|
appRoot = fso.GetParentFolderName(scriptDir)
|
||||||
WshShell.CurrentDirectory = appRoot
|
WshShell.CurrentDirectory = appRoot
|
||||||
|
|
||||||
' Set environment variables for the child process. WshShell.Environment("Process")
|
' Set env vars for the child process (inherited via WshShell.Run)
|
||||||
' is writable and child processes spawned via Run inherit it.
|
|
||||||
Set procEnv = WshShell.Environment("Process")
|
Set procEnv = WshShell.Environment("Process")
|
||||||
procEnv("PYTHONPATH") = appRoot & "\app\src"
|
procEnv("PYTHONPATH") = appRoot & "\app\src"
|
||||||
procEnv("WLED_CONFIG_PATH") = appRoot & "\app\config\default_config.yaml"
|
procEnv("WLED_CONFIG_PATH") = appRoot & "\app\config\default_config.yaml"
|
||||||
|
|
||||||
' Use embedded Python if present (installed dist), otherwise system Python
|
' Use embedded python.exe (NOT pythonw.exe) with WindowStyle=0.
|
||||||
embeddedPython = appRoot & "\python\pythonw.exe"
|
' Same pattern as the Media Server sibling app.
|
||||||
|
embeddedPython = appRoot & "\python\python.exe"
|
||||||
If fso.FileExists(embeddedPython) Then
|
If fso.FileExists(embeddedPython) Then
|
||||||
WshShell.Run """" & embeddedPython & """ -m wled_controller", 0, False
|
WshShell.Run """" & embeddedPython & """ -m wled_controller", 0, False
|
||||||
Else
|
Else
|
||||||
|
|||||||
Reference in New Issue
Block a user