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

Pashua's exit code is 0 after an error #18

Open
phloggu opened this issue Apr 20, 2020 · 1 comment
Open

Pashua's exit code is 0 after an error #18

phloggu opened this issue Apr 20, 2020 · 1 comment

Comments

@phloggu
Copy link

phloggu commented Apr 20, 2020

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!

@phloggu
Copy link
Author

phloggu commented Apr 20, 2020

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
}

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

No branches or pull requests

1 participant