Skip to content
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: Fix exit status code 7 for the --list option #212

Merged
merged 1 commit into from
Jul 9, 2024
Merged

Conversation

Antiz96
Copy link
Owner

@Antiz96 Antiz96 commented Jul 9, 2024

Description

The exit status code 7 invoked if there are no pending update when using the -l/--list option was not honored because of the sed part piped into the call of the list_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 this sed 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:

image

After:

image

Fixed bug

Fixes #211

The exit status code 7 invoked if there are no pending update when using the `-l/--list` option was not honored because of the `sed` part piped into the call of the `list_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 this `sed` 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.

Fixes #211
@Antiz96 Antiz96 added this to the v2.3.0 milestone Jul 9, 2024
@Antiz96 Antiz96 merged commit 814c489 into main Jul 9, 2024
1 check passed
@Antiz96 Antiz96 deleted the fix_exit_7 branch July 9, 2024 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exit status code 7 for the --list option is not honored
1 participant