Skip to content

improve handling of redundant output on stdout for commands that emit consumable information #4118

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
Feb 10, 2022

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Feb 10, 2022

motvation: some CLI command emit consumable informaiton such as json. in those case we dont want to include any other information on stdout, so that it can be consumed by pipes

changes:

  • for the following commands:
    • swift package dump-package
    • swift package dump-pif
    • swift package describe
    • swift package experimental-api-diff
    • swift package show-dependencies
    • swift test --list
  • redirect stdout to stderr prior to calling other actions
  • adjust result printing to always use stdout

rdar://78612028

@tomerd tomerd changed the title improve handling of redundant output on stdout for commands that emit… improve handling of redundant output on stdout for commands that emit consumable information Feb 10, 2022
… consumable information

motvation: some CLI command emit consumable informaiton such as json. in those case we dont want to include any other information on stdout, so that it can be consumed by pipes

changes:

* for the following commands:
  * swift package dump-package
  * swift package dump-pif
  * swift package describe
  * swift package experimental-api-diff
  * swift package show-dependencies
  * swift test --list
* redirect stdout to stderr prior to calling other actions
* adjust result printing to always use stdout
* adjust tests

rdar://78612028
@tomerd tomerd added the ready Author believes the PR is ready to be merged & any feedback has been addressed label Feb 10, 2022
@tomerd

This comment was marked as outdated.

@tomerd

This comment was marked as outdated.

@tomerd
Copy link
Contributor Author

tomerd commented Feb 10, 2022

@swift-ci smoke test linux

@neonichu
Copy link
Contributor

It's an existing function and might just be me, but I find the name redirectStdoutToStderr very misleading. I was thinking we were doing something with the actual underlying streams when we're actually just setting a variable :) Maybe useStdErrAsOutputStream or something could be clearer.

@tomerd
Copy link
Contributor Author

tomerd commented Feb 10, 2022

It's an existing function and might just be me, but I find the name redirectStdoutToStderr very misleading. I was thinking we were doing something with the actual underlying streams when we're actually just setting a variable :) Maybe useStdErrAsOutputStream or something could be clearer.

good point. planning to make more changes in this area, including dealing with this function so will handle it then

@tomerd tomerd merged commit 0a3e43b into swiftlang:main Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Author believes the PR is ready to be merged & any feedback has been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants