Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

ExternalProcess: How to check for more than one return codes from an external process?

norbyltd March 19, 2017

The  checkReturnCode() method - https://docs.atlassian.com/bamboo/5.1/com/atlassian/bamboo/task/TaskResultBuilder.html#checkReturnCode(com.atlassian.utils.process.ExternalProcess,%20int) - has the unfortunate behavior that is documented as "Will only check tests if the build state has not been set to Failed for some other reason.".

This means that you cannot check for more than one exit code, because if you check for the first and it fails (i.e. it is not that code), you will not be able to check another one that might have succeeded.

How can I workaround this?

 

Alternatively, is there a way to just retrieve the return code?  That would solve the problem.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
norbyltd March 19, 2017

Answering my own question:

 

You can call builder.success().build() to reset the TaskResultBuilder 'builder' to a success state, and then checkReturnCode() will not be ignored.

TAGS
AUG Leaders

Atlassian Community Events