BlueM/Pashua

Pashua's exit code is 0 after an error

Opened this issue · 1 comments

Pashua exits with zero even when loading a pashua template with errors. Pashua shows a dialog window describing the error, but does not exit non-zero. I would expect that the exit code is different from 0, when the program encounters an error of any kind.

Calling Pashua from within bash scripts, it would be useful to detect such failures and act accordingly. Since there are no variables set by Pashua after such an error and no output given neither after successful nor unsuccessful exit, an error can't be detected easily.

With an exit code, it would be easier:

pashua_run "my_template_with_errors.pashua"
if [ $? -ne 0 ]; then
  # treat error
elif [ $cb -eq 1 ]; then
  # cancel was pressed
...

Please introduce exit codes for Pashua. Thank you!

A work around in the meantime is to alter pashua_run and test for an empty result set:

[...]
57: # Get result
    local result=$("$pashuapath" "$pashua_configfile")

    # if result is empty, something went wrong
    if [ -z "$result" ]; then
      rv=1
    fi
[...]
    IFS="$oldIFS"
    return $rv
}