-
Notifications
You must be signed in to change notification settings - Fork 709
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
FIX: Use standard error for die(), dieWithHelp(), and error messages #404
base: master
Are you sure you want to change the base?
Conversation
By convention, error output should be printed to standard error, not standard out. Same for the usage help that may accompany the error message.
To indicate that something went wrong (e.g. the task already was unprioritized). Note: For actions that handle multiple ITEMs in a loop, we cannot use die() as that would abort processing of any following ITEM(s). Instead, use a status variable and set it to 1 on error, then exit at the end.
@@ -1211,9 +1212,11 @@ case $action in | |||
echo "TODO: $item deprioritized." | |||
fi | |||
else | |||
echo "TODO: $item is not prioritized." | |||
echo >&2 "TODO: $item is not prioritized." | |||
status=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary here to leave the whole process with failure exit status? Maybe you could test if other $item
s succeed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, failure is the inability to do what I was told, even if I partially succeeded. The user still has the action's output to see which items succeeded and which didn't; the exit status is more of interest from a scripting perspective; the shell doesn't visualize the exit status by default (but I color the following prompt red if there was an error). And from that scripting perspective, it's more interesting whether the whole command succeeded, not whether it got partially done. (And you can always use a loop and invoke the command with each item separately to obtain that information.)
Could you help me out how to use this PR as a base for mine? I can't find any description concerning this. |
@chrysle There's still a long queue of PRs waiting to be merged, so I don't think it's worth the effort to properly base your changes on mine. Just add the |
Before submitting a pull request, please make sure the following is done:
master
.fixes #XX
reference to the issue that this pull request fixes.