You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by zbc <zh...@163.com> on 2009/02/20 09:39:18 UTC

how to run two exec tasks within the same command shell

the two executable file, one is called "setENV.cmd", the other is called
"doThings.exe". 
in the windows command console, the "setENV.cmd" is used to setup the
environment, and it must be run first, then the "doThings.exe" can be run.
or not, "doThings.exe" can't work. the manual operation works well, because
we can type the two commands within the SAME command console. 
but while i run them in the ant script by exec task, there is problem., the
build.xml snippet is as follow: 

<target name="deploy"> 
<exec executable="setENV.cmd" /> 
<exec executable="doThings.exe"> 
<arg value="......" /> 
<arg value="......" /> 
</exec> 
</target> 


while i execute the target, i am sure the "setENV.cmd" is run well, but the
"doThings.exe" can't work well, 
that means the two exec tasks are not run within the same command shell, who
can tell me how to config the ant to run the two exec tasks within the same
shell? 

Thanks 

-- 
View this message in context: http://www.nabble.com/how-to-run-two-exec-tasks-within-the-same-command-shell-tp22116826p22116826.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: how to run two exec tasks within the same command shell

Posted by Shawn Castrianni <Sh...@halliburton.com>.
Out of curiosity, is it even possible to fix ANT to prevent this workaround?  ANT is Java based, so it is a general Java question, "Can Java launch a single process and then feed commands to that same process so that subsequent commands are affected by the prior commands?"  If it isn't even possible to do this in Java, then I don't have to bother submitting an enhancement request to ANT.  This would also solve my other problem which I posted a few days ago about running a series of setupEnv.bat commands before invoking a Java command.

---
Shawn Castrianni

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Sent: Friday, February 20, 2009 3:14 AM
To: user@ant.apache.org
Subject: AW: how to run two exec tasks within the same command shell

>the two executable file, one is called "setENV.cmd", the other is
called "doThings.exe". 
>in the windows command console, the "setENV.cmd" is used to setup the
>environment, and it must be run first, then the "doThings.exe" can be
run.
>or not, "doThings.exe" can't work. the manual operation works well,
because
>we can type the two commands within the SAME command console. 
>but while i run them in the ant script by exec task, there is problem.,
the
>build.xml snippet is as follow: 
>
><target name="deploy"> 
><exec executable="setENV.cmd" /> 
><exec executable="doThings.exe"> 
><arg value="......" /> 
><arg value="......" /> 
></exec> 
></target> 

>
>while i execute the target, i am sure the "setENV.cmd" is run 
>well, but the "doThings.exe" can't work well, 
>that means the two exec tasks are not run within the same 
>command shell, who can tell me how to config the ant to run the two
exec tasks 
>within the same shell? 


<exec> starts a new thread/process. Therefore you cant process two
'executables' in the 
same <exec>.
What you could do is a workaround:
- create a batch file with all invokations
- call the batch


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: how to run two exec tasks within the same command shell

Posted by Ja...@rzf.fin-nrw.de.
>the two executable file, one is called "setENV.cmd", the other is
called "doThings.exe". 
>in the windows command console, the "setENV.cmd" is used to setup the
>environment, and it must be run first, then the "doThings.exe" can be
run.
>or not, "doThings.exe" can't work. the manual operation works well,
because
>we can type the two commands within the SAME command console. 
>but while i run them in the ant script by exec task, there is problem.,
the
>build.xml snippet is as follow: 
>
><target name="deploy"> 
><exec executable="setENV.cmd" /> 
><exec executable="doThings.exe"> 
><arg value="......" /> 
><arg value="......" /> 
></exec> 
></target> 

>
>while i execute the target, i am sure the "setENV.cmd" is run 
>well, but the "doThings.exe" can't work well, 
>that means the two exec tasks are not run within the same 
>command shell, who can tell me how to config the ant to run the two
exec tasks 
>within the same shell? 


<exec> starts a new thread/process. Therefore you cant process two
'executables' in the 
same <exec>.
What you could do is a workaround:
- create a batch file with all invokations
- call the batch


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org