Forum: Ruby Using Ant from Ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
38b3d23420c70a0c2eb987242f7c37cb?d=identicon&s=25 unknown (Guest)
on 2006-06-05 17:29
(Received via mailing list)
Hi

I am writing a Ruby script to automate some process. Part of it involves
running an ant script ( the java build tool from apache). But, I am
finding it difficult to make it work.

I tried system('ant') but it didn't work. It just returned a false. I
have
checked that ant is there in my system path.
Another strange thing is that it works when I provide some input or
output
redirections. e.g. if I run system('ant > abc.txt'), the command runs.

I also tried `ant` but that also didn't work and returned the following
error.
Errno::ENOEXEC: Exec format error - ant

In this case also `ant < abc.txt` or `ant > abc.txt` works!!

I am using Windows 2000 machine and have cygwin and 4nt installed. I am
running these commands on irb promt on 4nt.
Can anyone please help me in this regard.

Thanks and regards
Sanchit Misra
2d532341317628fbb2cb22ec427a1d62?d=identicon&s=25 Stefan Lang (Guest)
on 2006-06-05 17:46
(Received via mailing list)
On Monday 05 June 2006 17:27, Sanchit.Misra@trilogy.com wrote:
> command runs.
>
> I also tried `ant` but that also didn't work and returned the
> following error.
> Errno::ENOEXEC: Exec format error - ant
>
> In this case also `ant < abc.txt` or `ant > abc.txt` works!!
>
> I am using Windows 2000 machine and have cygwin and 4nt installed.
> I am running these commands on irb promt on 4nt.
> Can anyone please help me in this regard.

I guess the "ant" command on Windows resolves to an ant.bat or ant.cmd
file. Others had similar problems with the "system" method.
Try to run:
    system "ant.bat"
or
    system "ant.cmd"
B99237feaffa5cb3b92827c0ab4fb437?d=identicon&s=25 ruby-talk ML (Guest)
on 2006-06-05 17:49
(Received via mailing list)
maybe you can try:

`cmd /c ant`


Sanchit.Misra@trilogy.com å??é?:
38b3d23420c70a0c2eb987242f7c37cb?d=identicon&s=25 unknown (Guest)
on 2006-06-05 18:02
(Received via mailing list)
system "ant.bat" worked!! thanks a lot

Sanchit




Stefan Lang <langstefan@gmx.at>
06/05/2006 09:13 PM
Please respond to
ruby-talk@ruby-lang.org


To
ruby-talk@ruby-lang.org (ruby-talk ML)
cc

Subject
Re: Using Ant from Ruby






On Monday 05 June 2006 17:27, Sanchit.Misra@trilogy.com wrote:
> command runs.
>
> I also tried `ant` but that also didn't work and returned the
> following error.
> Errno::ENOEXEC: Exec format error - ant
>
> In this case also `ant < abc.txt` or `ant > abc.txt` works!!
>
> I am using Windows 2000 machine and have cygwin and 4nt installed.
> I am running these commands on irb promt on 4nt.
> Can anyone please help me in this regard.

I guess the "ant" command on Windows resolves to an ant.bat or ant.cmd
file. Others had similar problems with the "system" method.
Try to run:
    system "ant.bat"
or
    system "ant.cmd"
38b3d23420c70a0c2eb987242f7c37cb?d=identicon&s=25 unknown (Guest)
on 2006-06-05 18:06
(Received via mailing list)
`cmd /c ant` also worked!
thanks

sanchit





ruby-talk ML <excity@gmail.com>
06/05/2006 09:22 PM
Please respond to
ruby-talk@ruby-lang.org


To
ruby-talk@ruby-lang.org (ruby-talk ML)
cc

Subject
Re: Using Ant from Ruby






maybe you can try:

`cmd /c ant`


Sanchit.Misra@trilogy.com å??é?:

> Hi
>
> I am writing a Ruby script to automate some process. Part of it involves

> running an ant script ( the java build tool from apache). But, I am
> finding it difficult to make it work.
>
> I tried system('ant') but it didn't work. It just returned a false. I
have
> checked that ant is there in my system path.
> Another strange thing is that it works when I provide some input or
output
This topic is locked and can not be replied to.