fix(initsystem): don't fail WinSCM start/stop/restart on benign slow-start warning#408
Open
vikramhh wants to merge 1 commit into
Open
fix(initsystem): don't fail WinSCM start/stop/restart on benign slow-start warning#408vikramhh wants to merge 1 commit into
vikramhh wants to merge 1 commit into
Conversation
…start warning When a Windows service stays in StartPending/StopPending for a moment (common on a cold first start), Start-Service/Stop-Service/Restart-Service emit a non-terminating "Waiting for service '...' to start/stop..." warning. That goes to the warning stream, which lands on stderr under a subprocess, and rig treats any Windows stderr output as a failure (ErrWroteStderr) unless AllowWinStderr is set. So a successful-but-slow start was reported as a failure. Add -WarningAction SilentlyContinue to the three cmdlets. This silences exactly the benign progress warning while -ErrorAction Stop still turns a genuine failure into a terminating (non-zero) error, so real error detection is preserved. Uses -WarningAction only, not AllowWinStderr, which would greenlight any stderr output and could mask unexpected diagnostics. Fixes k0sproject#404 Signed-off-by: Vikram bir Singh <vsingh@mirantis.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vikramhh
force-pushed
the
fix/winscm-benign-start-warning
branch
from
July 23, 2026 15:42
328ea8b to
7066c3c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a Windows target,
WinSCM.StartService/StopService/RestartServicerunStart-Service/Stop-Service/Restart-Servicewith only-ErrorAction Stop.When a service stays in StartPending/StopPending for a moment (common on a cold
first start doing real init work), PowerShell emits a non-terminating warning:
That warning goes to the warning stream, which lands on stderr under a
subprocess. rig treats any Windows stderr output as a failure
(
cmd.ErrWroteStderr) unlessAllowWinStderris set, so a successful-but-slowstart is reported as
command wrote output to stderr. The command exits 0 andthe service does reach Running — only the benign warning trips the failure.
(The executor already sets
$ProgressPreference='SilentlyContinue', whichcovers the progress stream but not the warning stream.)
Fix: add
-WarningAction SilentlyContinueto the three cmdlets. This silencesexactly the benign progress warning while
-ErrorAction Stopstill turns agenuine failure into a terminating (non-zero) error, so real error detection is
preserved. Per review on the issue, this uses
-WarningActiononly and doesnot set
AllowWinStderr, which would be a blunt instrument that greenlightsany stderr output and could mask unexpected diagnostics.
EnableService/DisableServiceuseSet-Service, which doesn't wait on astate transition and so doesn't emit this warning — left unchanged.
Existing
winscm_test.gosuccess cases now also assert the flag is present;they fail on the pre-fix code and pass after.
go vet/gofmtclean.Fixes #404