Send container machine run forced-exit diagnostic to stderr - #2073
Open
vyncint wants to merge 1 commit into
Open
Send container machine run forced-exit diagnostic to stderr#2073vyncint wants to merge 1 commit into
container machine run forced-exit diagnostic to stderr#2073vyncint wants to merge 1 commit into
Conversation
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.
Type of Change
Motivation and Context
Part of #642.
container machine runinstalls aSignalThresholdhandler to report the forced exit after three SIGINT/SIGTERMs, but emits that diagnostic withprint(), so it goes to stdout.The identical handler in the sibling commands uses
log.warning(), which the CLI routes to stderr throughStderrLogHandler:ContainerRun.swift#L167ContainerExec.swift#L105The handler is only installed when
!tty— precisely when stdout is likely a pipe or a file — so the diagnostic is interleaved into the machine process's redirected output rather than kept on the terminal.This routes the message to stderr, matching the sibling commands.
let log = self.logis bound before the closure for the same reason it is in those two:SignalThreshold.starttakes a@Sendable @escapingclosure.Testing
Tested locally
Added/updated tests
Added/updated docs
swift build -c debug -Xswiftc -warnings-as-errors -Xswiftc -enable-testing— cleanmake test— 613 tests in 71 suites passedswift format lint --strict --configuration .swift-format-nolinton the changed file — cleanConfirmed the stream routing with the built binary: logger output goes to stderr (
container image load -i /nonexistentwrites only to stderr) andprint()output goes to stdout (container --version).I did not exercise the three-signal path end to end, as that needs a booted container machine; the change is a like-for-like swap to the logger the sibling commands already use on that same code path.