Skip to content

[6.0] swift sdk: print warnings on stderr instead of stdout #7533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2024

Conversation

MaxDesiatov
Copy link
Contributor

@MaxDesiatov MaxDesiatov commented May 7, 2024

Cherry-pick of #7532.

Explanation: Tools and scripts may rely on command output to remain parseable, so printing these warnings on stdout can break such workflows. We should output these warnings on stderr instead.

As these warnings are emitted before any logging is available, we're using fputs for output on stderr

Scope: Isolated to swift sdk command and subcommands.
Risk: Low, the actual change is only 4 lines touching print and import, code coverage for those is present.
Testing: End-to-end test cases present in Tests/CommandsTests/SDKCommandTests.swift
Issue: N/A
Reviewer: @bnbarham

Tools and scripts may rely on command output to remain parseable, so printing these warnings on `stdout` can break such scripts. We should output these warnings on `stderr` instead.

As these warnings are emitted before any logging is available, we're using `fputs` for output on `stderr`
@MaxDesiatov MaxDesiatov added the swift 6.0 Related to Swift 6.0 release branch label May 7, 2024
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov MaxDesiatov marked this pull request as ready for review May 7, 2024 16:06
@MaxDesiatov MaxDesiatov self-assigned this May 7, 2024
@MaxDesiatov MaxDesiatov assigned bnbarham and unassigned MaxDesiatov May 7, 2024
@MaxDesiatov MaxDesiatov merged commit de0e744 into release/6.0 May 8, 2024
5 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/sdk-stderr-6.0 branch May 8, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants