You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Eric Fetzer <el...@yahoo.com> on 2010/04/14 17:26:50 UTC

Calling CYGWIN from ANT via EXEC

It's actually much easier to use CYGWIN from Ant than stated in the documentation with the <exec> task.  Here is an example of using Ant to run a shell script via CYGWIN (be sure the shell script is formatted for unix):
                   <exec executable="c:\cygwin\bin\bash.exe">
                     <arg value="--login"/>
                     <arg value="-c"/>
                     <arg value="/cygdrive/c/BuildDeployScripts/scp_files.sh ${scp.keyfile} ${fileToSCP} ${scp.user} ${scp.remote.host} ${scp.target.dir}"/>
                   </exec>
Note that all arguments to the script in this case must be on the same <arg> as the script file or they won't show up as args to the script, but rather, args to bash.  I haven't figured out how to send an argument with spaces in it, but I'm sure you Ant guru's could tell me.  Any help there?  I tried 'myScript.sh "argument with spaces" arg2', but that didn't work.  CYGWIN wants spaces escaped.

Thanks,
Eric



      

Re: Calling CYGWIN from ANT via EXEC

Posted by Antoine Levy Lambert <an...@gmx.de>.
Eric Fetzer wrote:
> It's actually much easier to use CYGWIN from Ant than stated in the documentation with the <exec> task.  Here is an example of using Ant to run a shell script via CYGWIN (be sure the shell script is formatted for unix):
>                    <exec executable="c:\cygwin\bin\bash.exe">
>                      <arg value="--login"/>
>                      <arg value="-c"/>
>                      <arg value="/cygdrive/c/BuildDeployScripts/scp_files.sh ${scp.keyfile} ${fileToSCP} ${scp.user} ${scp.remote.host} ${scp.target.dir}"/>
>                    </exec>
> Note that all arguments to the script in this case must be on the same <arg> as the script file or they won't show up as args to the script, but rather, args to bash.  I haven't figured out how to send an argument with spaces in it, but I'm sure you Ant guru's could tell me.  Any help there?  I tried 'myScript.sh "argument with spaces" arg2', but that didn't work.  CYGWIN wants spaces escaped.
>
> Thanks,
> Eric
>
>
>
>       
>   
I would have 2 suggestions for you :

- make a wrapper bash script to work around the issue of argument with 
spaces, maybe write the arguments to a file that cygwin bash can source like

arg1=something
arg2=bla
...


- or get cygwin and scripting out of the equation and reimplement 
completely in ant what scp_files.sh does, if it is not too complicated. 
The name suggests that you could use the scp task of ant.

Regards,

Antoine

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


RE: Calling CYGWIN from ANT via EXEC

Posted by Martin Gainty <mg...@hotmail.com>.
i believe the majority of  SGML parsers will parse
&nbsp 
better known as non-braking space character as 'space character'

you can also try the old hex 20 e.g.
&#32;

if its Windoze folder name try the '8.3 name'
C:\Documents and Settings 
becomes
C:\DOCUME~1

dumb question but i have to ask why not launch cygwin beforehand and run your ant scripts from there?
(at least you would have the same JVM and classloader)

?
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.






> Date: Wed, 14 Apr 2010 08:26:50 -0700
> From: elstonkers@yahoo.com
> Subject: Calling CYGWIN from ANT via EXEC
> To: user@ant.apache.org
> 
> It's actually much easier to use CYGWIN from Ant than stated in the documentation with the <exec> task.  Here is an example of using Ant to run a shell script via CYGWIN (be sure the shell script is formatted for unix):
>                    <exec executable="c:\cygwin\bin\bash.exe">
>                      <arg value="--login"/>
>                      <arg value="-c"/>
>                      <arg value="/cygdrive/c/BuildDeployScripts/scp_files.sh ${scp.keyfile} ${fileToSCP} ${scp.user} ${scp.remote.host} ${scp.target.dir}"/>
>                    </exec>
> Note that all arguments to the script in this case must be on the same <arg> as the script file or they won't show up as args to the script, but rather, args to bash.  I haven't figured out how to send an argument with spaces in it, but I'm sure you Ant guru's could tell me.  Any help there?  I tried 'myScript.sh "argument with spaces" arg2', but that didn't work.  CYGWIN wants spaces escaped.
> 
> Thanks,
> Eric
> 
> 
> 
>       
 		 	   		  
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5