← Back to team overview

sikuli-driver team mailing list archive

[Question #694632]: Command line execution return code on script abort

 

New question #694632 on Sikuli:
https://answers.launchpad.net/sikuli/+question/694632

Version: SikuliX 2.0.4 on Windows 10, Running Java 1.8.0_191

Setup:
I use Sikulix for GUI-testing.
I have a batch-script which calls different scripts in a loop. Every script is started in a clean enviroment and should be independent from the exit status of previous executions. The whole thing should run unattended and write a log file where it says which scripts have done a complete run.

Part of my Batch script: (%%d is the current script in the loop)

call java -jar Sikulix.jar -f logs/sikulix/%%d_%date%.log -r Tests/%%d
REM ERRORLEVEL 42 = Success because abort due to an error also returns Errorlevel 0
IF ERRORLEVEL 42 (
 echo [%DATE% %TIME%]: %%d passed. >> logs/%DATE%_success.log
 echo %%d passed
) ELSE (
 echo [%DATE% %TIME%]: %%d failed with return code %errorlevel% >> logs/%DATE%_failed.log
 echo %%d failed.
)

Problem:
When a SikuliX script gets aborted (FindFailed for example) the return code is always 0. That is not what i would expect. I expect a return code 0 only when everything went well. Therefore i need this ugly workaround that every script has an exit(42) at the end because that is the only case where everything went well.
try:/excerpt block is not practical for me because i want a different return code whenever anything unforeseen happens.

Is this a feature by design or a bug?
And if it is a bug it would be nice to have it fixed.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.