Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): tolerate missing local autostart task (#3229)

Francesco Bonaccif9132440013e
diff --git a/libs/cua-driver/scripts/install-local.ps1 b/libs/cua-driver/scripts/install-local.ps1
index 0a106f8636..b1f5733b4a 100644
--- a/libs/cua-driver/scripts/install-local.ps1
+++ b/libs/cua-driver/scripts/install-local.ps1
@@ -148,7 +148,18 @@ function Register-CuaDriverAutostart {
}
function Stop-CuaDriverLocalDaemons {
- & schtasks.exe /End /TN "cua-driver-local-serve" 2>$null | Out-Null
+ # A missing task is the normal state for -NoAutoStart and for a first
+ # install. Windows PowerShell 5.1 promotes schtasks.exe stderr to an
+ # ErrorRecord, so temporarily relax the script-wide Stop preference for
+ # this deliberately best-effort cleanup.
+ $previousPreference = $ErrorActionPreference
+ $ErrorActionPreference = "Continue"
+ try {
+ & schtasks.exe /End /TN "cua-driver-local-serve" 2>$null | Out-Null
+ }
+ finally {
+ $ErrorActionPreference = $previousPreference
+ }
Get-Process -Name "cua-driver-local","cua-driver-uia-local" -ErrorAction SilentlyContinue |
Stop-Process -Force -ErrorAction SilentlyContinue
}