It's all about the answers!

Ask a question

Executing multiple external scripts in one step exits prematurely


Lakshmi Pandeti (111) | asked Apr 11 '13, 12:16 p.m.

Tool : Build Forge

I am trying to execute external scripts in one step . But it exits after executing first script

Ex :

if exist Adir pushd Adir & dir & mvn install  & popd & dir # Build forge executes

if exist Bdir pushd Bdir & dir & mvn install & popd & dir # Build forge does not execute

if exist Cdir pushd Cdir & dir & mvn install  & popd & dir # Build forge does not execute

if exist Ddir pushd Ddir & dir & mvn install  & popd & dir # Build forge does not execute

If i do not execute any external scripts it works fine.

Ex :

if exist Adir pushd Adir & dir & echo mvn install  & popd & dir # Build forge executes

if exist Bdir pushd Bdir & dir & echo mvn install & popd & dir # Build forge does not execute

if exist Cdir pushd Cdir & dir & echo mvn install  & popd & dir # Build forge does not execute

if exist Ddir pushd Ddir & dir & echo mvn install  & popd & dir # Build forge does not execute

Can i run this in multiple steps?. Yes, but it increases complexity to end user and i am trying to find a solution which would help user in future.

Thanks,

2 answers



permanent link
Ryan Ruscett (1.0k413) | answered Apr 11 '13, 12:47 p.m.

Hello, 

I have been able to reproduce this issue when running scripts in Build Forge. If you have four steps and step three is a script. Build Forge will do steps 1, 2, and 3... But not the steps after the script.

Have you looked into creating conditional steps? If X then Y. Seems like that may be an option.  More logical for future users.  You can also specify and Else.

You could even create a library and name it accordingly. Put all 4 steps in different steps but all the library excecut_X_Y_Z. Then run that as an inlne to any project. This will make your "execution setup" more scalable.

You want to run this. Inline this. Seems like a user friendly way to do it. But it's just my opinion.

http://pic.dhe.ibm.com/infocenter/bldforge/v7r1m3/topic/com.ibm.rational.buildforge.doc/topics/steps_exec_conditional.html


permanent link
Joshua Keefe (1011) | answered May 23 '13, 12:10 p.m.
Another option other than conditional steps as Ryan had mentioned would be step log filters.

If the step is configured to use the " -- Exit Code --" as the return option, that the behavior where the step would complete after the first script finishes would be expected.
As the initial script would provide an exit code, which the step will use a condition to end.

Using a step log filter can allow the multiple script to run under a single step.
It would be recommended to configure the log filter to configure the step to set the step to a fail state at the beginning, and reset the step state to pass only if an appropriate condition is met.
Otherwise, you would have to configure any condition that would result in a failure of the step.

Log filters
http://pic.dhe.ibm.com/infocenter/bldforge/v7r1m3/topic/com.ibm.rational.buildforge.doc/topics/projects_logfilter__top.html

Otherwise, you can place the multiple script under a wrapper to run all the script and provide a single exit code to the step.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.