# Calling ant from ruby, on windows

**URL:** <https://www.ruby-forum.com/t/calling-ant-from-ruby-on-windows/167217>\
**Category:** Ruby\
**Created:** [May 5, 2009, 4:38pm UTC](https://www.ruby-forum.com/t/calling-ant-from-ruby-on-windows/167217 "2009-05-05T16:38:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![melladh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3bc359/32.png) [@melladh](https://www.ruby-forum.com/u/melladh)\
**Post date:** [May 5, 2009, 4:38pm UTC](https://www.ruby-forum.com/t/calling-ant-from-ruby-on-windows/167217/1 "2009-05-05T16:38:47Z")

</div>

I’ve got a script that I want to run on both osx10.5 and windows xp,  
though I’ll settle for one script each if that is not possible. My  
problem is with xp. Note that I’m a beginner to ruby, and I apologize if  
this is a stupid mistake to make, but I haven’t found any help looking  
on google.

On osx I have a system call like this  
system(“ant build”)  
which works fine on osx, but on windows I get nothing. It just returns.  
I can run system(“mem”) and get a printout, I’ve even run system(“python  
–version”) to check that ruby does read the path. But ant is ignored. I  
noted a similar behaviour when doing a system(“bleh”) call (“bleh”  
obviously NOT being a valid system call).

I’ve tried supplying the direct path to ant, i.e.  
system(“c:\antdir\bin\ant -version”)  
I’ve made sure that the path contains the ant path (both system and user  
path), ANT\_HOME is set - I can call ant just fine from the command  
line…

What am I missing?

(For anyone curious, the reason I’m running ruby is because I want to  
loop through a directory, finding other directories, and run the ant  
build script for each of the directories found)

---

<div class="post-metadata">

**Author:** ![melladh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3bc359/32.png) [@melladh](https://www.ruby-forum.com/u/melladh)\
**Post date:** [May 5, 2009, 4:47pm UTC](https://www.ruby-forum.com/t/calling-ant-from-ruby-on-windows/167217/2 "2009-05-05T16:47:10Z")

</div>

Hi,

2009/5/5 Marie-sofie Karlsson [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> –version") to check that ruby does read the path. But ant is ignored. I

Try  
system(“ant.bat build”)

Regards,

Park H.

---

<div class="post-metadata">

**Author:** ![melladh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3bc359/32.png) [@melladh](https://www.ruby-forum.com/u/melladh)\
**Post date:** [May 5, 2009, 4:50pm UTC](https://www.ruby-forum.com/t/calling-ant-from-ruby-on-windows/167217/3 "2009-05-05T16:50:51Z")

</div>

Heesob P. wrote:

> Hi,
> 
> 2009/5/5 Marie-sofie Karlsson [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > –version") to check that ruby does read the path. But ant is ignored. I
> 
> Try  
> system(“ant.bat build”)
> 
> Regards,
> 
> Park H.

Thank you, that works
