The most common way to end a run early is with the abort
command.
- sh: doSomething.sh
watch:
- regex: FATAL
then:
- abort: fatal error in doSomething.sh
By default, abort
stops the setup-scripts
and run-scripts
but
qDup will still download anything that was queued with queue-download
and by default it will still run the cleanup-scripts
.
We can prevent the cleanup-scripts
with the skip-cleanup
option in the full command syntax.
- sh: doSomething.sh
watch:
- regex: FATAL
then:
- abort:
message: fatal error in doSomething.sh
skip-cleanup: true
The other way to abort a run early is to check exit codes for sh
commands.
qDup checks the exit code after every sh
that uses the default prompt (not commands that end with prompts from add-prompt
).
We can enable exit code checking on specific 'sh' commands by setting ignore-exit-code: false
.
- sh:
command: doSomething.sh
ignore-exit-code: false
We can also tell qDup to check all sh
exit codes with the -x
, --exit-code
command line argument or by adding check-exit-code: true
to the global settings
global:
settings:
check-exit-code: true
Several commands have non-zero exit codes for common scenarios. which java
will have a non-zero exit code if java is missing. We can globally enable check-exit-code
then disable it for specific sh
commands where we expect a non-zero exit code
- sh:
command: which java
ignore-exit-code: true
then:
- regex: no java
then:
- sh: "installJava.sh"