Reputation: 8707
I have below code in a Robot script:
${RC}= Run Process ${CURDIR}/my.bat ${CURDIR} ${target}
Run Keyword If ${RC} != 0 Stop Test "Error BATCH"
I get below error:
Evaluating expression '<result object with rc 0> != 0' failed: SyntaxError: invalid syntax (<string>,line1)
I tried many ways like = 'PASS' or other ways but still I get the same issue - the batch file will either return 0 or %ERRORLEVEL%
How can I solve the issue?
Upvotes: 1
Views: 2629
Reputation: 849
Run Process
keyword returns an object. If you want to access the return code
or rc
from the object you should use ${variableName.rc}
.
In your case, the code should be changed as follows:
${RC}= Run Process ${CURDIR}/my.bat ${CURDIR} ${target}
Run Keyword If ${RC.rc} != 0 Stop Test "Error BATCH"
To access other values from the object check this section from the Process
library documentation.
Upvotes: 4