Skip to content

Commit

Permalink
Fix: Set exit code to the total number of conversion failures
Browse files Browse the repository at this point in the history
Problem: Whether there were conversion failures or not, pacpl always
ends with exit code 0, which makes it not practical to use it from a
shell script, since it would be necessary to parse the final message to
discover whether there were failures.
Solution: As $total_failures has lexical file scope, after finishing
processing all files, we can call "exit $total_failures", so that any
scripts calling pacpl can know if it was 100%  successful or had some
failure just by testing the exit code.
  • Loading branch information
marcelpaulo committed Jun 5, 2018
1 parent 97297d1 commit 0abb4b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pacpl.in
Original file line number Diff line number Diff line change
Expand Up @@ -3595,7 +3595,7 @@ if (@ARGV) {

load_user_modules() if $config{IMPORTM} == 1;

if ($to and @ARGV and not $rip) { proc_input(); }
if ($to and @ARGV and not $rip) { proc_input(); exit $total_failed; }

elsif ($to and $rip) { proc_cd(); }
elsif ($my_encoder and not $to) { show_encoders(); }
Expand Down

0 comments on commit 0abb4b5

Please sign in to comment.