canonical / craft-parts

https://canonical-craft-parts.readthedocs-hosted.com
GNU Lesser General Public License v3.0
11 stars 37 forks source link

feat: split stderr for better error presentation #897

Open bepri opened 2 weeks ago

bepri commented 2 weeks ago

cmatsuoka commented 1 week ago

This can be also implemented in the craft-cli stream context manager, allowing stream remix for anything that runs inside the context manager instead of being limited to just craft-parts executors. This would be the most generic and preferred solution. You can experiment with that before proposing this PR to see how it works.

The stderr output goes upwards through an exception and not as a stream, so this is the place it must be.

bepri commented 11 hours ago

In craft-application, it was found that tests would fail if they used the capsys fixture with this PR. The capfd fixture is a total drop-in replacement, and in all cases, using it instead of capsys resolves the test failures. It appears that capfd does a "more proper" file redirection. A companion PR in craft-application will be opened to fix those tests.