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

Abort on non-zero blastcmd exit code #213

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SamStudio8
Copy link

@SamStudio8 SamStudio8 commented Dec 9, 2024

Currently, Abricate will exit successfully regardless of the exit code of the BLAST command. This is misleading as failures in the BLAST command (eg. if it is killed by the OOM killer) will emit the message "Found 0 genes in $file", rather than indicating an error has ocurred.

This change checks the exit code of the executed command after close is called. If it is non-zero, Abricate will terminate with a brief message and the same exit code; allowing the calling shell to decide what to do with the error.

This change uses a bash subshell instead of sh to make use of pipefail. For anyone who wants to continue using sh I wave my hands in the air and leave it as an exercise to anyone who wishes to inspect the exit code of each piped command instead.

I leave this around in the hope it may be useful for someone!

Currently, Abricate will exit successfully regardless of the exit code
of the BLAST command. This is misleading as failures in the BLAST
command (eg. if it is killed by the OOM killer) will emit the message
"Found 0 genes in <file>", rather than indicating an error has ocurred.

This change checks the exit code of the executed command after close
is called. If it is non-zero, Abricate will terminate with a brief
message and the same exit code; allowing the calling shell to decide
what to do with the error.

This change uses a bash subshell instead of sh to make use of pipefail.
For anyone who wants to continue using sh I wave my hands in the air
and leave it as an exercise to anyone who wishes to inspect the exit
code of each piped command instead.
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.

1 participant