fix: Fix exit status code 7 for the --list option #212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The exit status code 7 invoked if there are no pending update when using the
-l/--list
option was not honored because of thesed
part piped into the call of thelist_package
function. Indeed, piped commands are executed in their own subshell, so the subshell invoked by the| sed
part is exited with status code 7 instead of the parent subshell (see https://www.gnu.org/software/bash/manual/html_node/Pipelines.html & https://relentlesscoding.com/posts/bash-commands-in-pipelines-subshells/ for more details). Given the very little benefit thissed
part brings (namely removing the last blank line of the output for purely aesthetic reason), it's not worth wrapping our head too hard on this. Let's just drop it.This commit also adds an info message that there is no update available for the
-l/--list
option (if that's the case).Screenshots / Logs
Before:
After:
Fixed bug
Fixes #211