Fix the bench scripts on Windows PowerShell 5.1

setup_workstation.ps1 stopped on the failed import of a missing Python package instead of installing it; start_overnight.ps1 stopped on the keep-awake call, whose 0x80000001 literal is read as a negative int.
This commit is contained in:
Ashin Walpola
2026-11-27 10:58:30 +01:00
parent aef65394ea
commit d27856aba1
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ function Run-Python([string[]]$a) { $rest = @(); if ($py.Count -gt 1) { $rest =
# Keep Windows awake for as long as this PowerShell process lives.
Add-Type -Namespace Win -Name Power -MemberDefinition '[DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint f);'
[void][Win.Power]::SetThreadExecutionState(0x80000001) # ES_CONTINUOUS | ES_SYSTEM_REQUIRED
[void][Win.Power]::SetThreadExecutionState([uint32]2147483649) # 0x80000001 = ES_CONTINUOUS | ES_SYSTEM_REQUIRED (PowerShell 5.1 reads that literal as a negative int)
# Which board: the one Espressif native-USB port, unless named.
if ($Port -eq "auto") {