Skip to content

swift sdk: print warnings on stderr instead of stdout #7532

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

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

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
Copy link
Contributor Author

@swift-ci test

@MaxDesiatov MaxDesiatov marked this pull request as ready for review May 7, 2024 14:30
@MaxDesiatov MaxDesiatov requested a review from xedin May 7, 2024 14:30
@MaxDesiatov MaxDesiatov enabled auto-merge (squash) May 7, 2024 15:30
@MaxDesiatov MaxDesiatov merged commit cca73b2 into main May 8, 2024
5 checks passed
@MaxDesiatov MaxDesiatov deleted the maxd/sdk-stderr branch May 8, 2024 00:38
MaxDesiatov added a commit that referenced this pull request May 8, 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
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
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`
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants