Skip to content

Conversation

@SamStudio8
Copy link
Contributor

@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.
@tseemann tseemann merged commit db0ce31 into tseemann:master Dec 4, 2025
@tseemann
Copy link
Owner

tseemann commented Dec 4, 2025

Thanks @SamStudio8 - this is something i didn't consider!

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.

2 participants