refactor: Handle stderr similar to stdout#1427
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1427 +/- ##
==========================================
- Coverage 85.28% 85.22% -0.06%
==========================================
Files 106 106
Lines 3798 3798
==========================================
- Hits 3239 3237 -2
- Misses 334 336 +2
Partials 225 225 ☔ View full report in Codecov by Sentry. |
|
It just came to me: If user resets command output (via SetErr) should we also set the err output stream for logging? |
|
I created and issue to investigate the logging idea. I'm not sure. As to go scripting, I think it should work just like shell scripting. By default stdout and stderr go to the current file descriptors. If the user wants to redirect stdout or stderr, they should be allowed to do that. Currently, they can only redirect stdout. |
One tricky point is that go scripting allows running several commands in parallel, and assign each run different files for stdout and stderr. Logging should go to the user-assigned stderr (but not need to be done in this PR). |
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
|
Created issue oras-project/oras-www#357 |
qweeah
left a comment
There was a problem hiding this comment.
LGTM though some printer are already imbedded in command options and no need to recreate. Will change that in another PR.
What this PR does / why we need it:
Use the
cmd.ErrOrStderr()for error output. This is more consistent and go scripting will be able to capture stderr.This should be the final PR for the printer although it may be worth looking at where things are and to see what could be improved.