Skip to content

Commit 5ee7bec

Browse files
committed
Stop the service test failing on its own success
schtasks reports "no such task" by exiting non-zero, which is the condition the uninstall check is looking for; pwsh then carried that exit code out of the step and failed the job. Check $LASTEXITCODE explicitly instead.
1 parent e7996f2 commit 5ee7bec

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,17 @@ jobs:
6666
schtasks /Query /TN colabapi
6767
colabapi service status
6868
colabapi service uninstall
69-
if (schtasks /Query /TN colabapi 2>$null) {
70-
Write-Error "task still present after uninstall"; exit 1
69+
# A missing task is what we WANT here, and schtasks reports that by
70+
# exiting non-zero. pwsh would otherwise carry that last exit code out
71+
# of the step and fail the job for succeeding, so check it explicitly
72+
# and finish on an exit code we choose.
73+
schtasks /Query /TN colabapi 2>$null | Out-Null
74+
if ($LASTEXITCODE -eq 0) {
75+
Write-Error "task still present after uninstall"
76+
exit 1
7177
}
7278
Write-Host "scheduled task installed, queried, and removed cleanly"
79+
exit 0
7380
shell: pwsh
7481

7582
- name: systemd unit installs (Linux only)

0 commit comments

Comments
 (0)