Menu

#9 Set the exit code to the total number of failures

PACPL
closed
None
5
2018-07-22
2018-06-06
No

IIII call pacpl from a bash script and I observed today that my script never detects when there was a conversion failure, even though I test the exit code of pacpl. Working on this issue, I realized that pacpl doesn't explicit set the exit code when it finished the conversion, whether it was 100% successful or not. This would force the script to parse the final message, to detect whether there were any failures, when simply testing the exit code would be so much more natural and easy.

As $total_failures is declared as lexical with file scope, the solution is simple: after processing all files, call exit $total_failures.

I've attached a patch.

1 Attachments

Discussion

  • Philip Lyons

    Philip Lyons - 2018-06-09
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -I call pacpl from a bash script and I observed today that my script never detects when there was a conversion failure, even though I test the exit code of pacpl. Working on [this issue](https://sourceforge.net/p/pacpl/patches/8/), I realized that pacpl doesn't explicit set the exit code when it finished the conversion, whether it was 100% successful or not. This would force the script to parse the final message, to detect whether there were any failures, when simply testing the exit code would be so much more natural and easy.
    +IIII call pacpl from a bash script and I observed today that my script never detects when there was a conversion failure, even though I test the exit code of pacpl. Working on [this issue](https://sourceforge.net/p/pacpl/patches/8/), I realized that pacpl doesn't explicit set the exit code when it finished the conversion, whether it was 100% successful or not. This would force the script to parse the final message, to detect whether there were any failures, when simply testing the exit code would be so much more natural and easy.
    
     As `$total_failures` is declared as lexical with file scope, the solution is simple: after processing all files, call `exit $total_failures`.
    
    • status: open --> pending
    • assigned_to: Philip Lyons
     
  • Philip Lyons

    Philip Lyons - 2018-06-09

    soundssoundssoundssosoundssoundssoundssosoundssoundssoundssoundsounds ggI'llsI'llI'llggI'llsI'llI'llI'llsI'llI'llI'llsI'llI'll

     
  • Philip Lyons

    Philip Lyons - 2018-06-17
    • status: pending --> accepted
     
  • Philip Lyons

    Philip Lyons - 2018-07-22
    • status: accepted --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB