Jruby "sometimes" executes external programs

Writing a jruby app and everything has gone fine until it needs to
execute an external program … that being an ant file. So there are a
few ant files in a list which need to be executed … however when I
iterate through them sometimes jruby executes them … and sometimes it
does not. It’s very strange. I’m using jruby 1.4 if that is any
indication of things. Here is the code:

@task_queue.each do |task_name|
if @executing == false then break end
puts " Executing task: #{task_name} @ #{Time.now.to_s}"
command_string = “…/programs/apache-ant-1.8.0/bin/ant.bat
#{build_log_string(task_name)} -f #{task_name}
#{build_variables_string} #{build_property_files_string(task_name)}”

output = IO.popen(command_string,"w+") do |ant_output|
  @task_pid = ant_output.pid
  ant_output.close_write
end
puts "  Finished task: #{task_name} @ #{Time.now.to_s}\n\n"

end

Am I doing something wrong? Any ideas?

On Apr 21, 2010, at 2:28 PM, Christopher Dancy wrote:

   command_string = "../programs/apache-ant-1.8.0/bin/ant.bat

Am I doing something wrong? Any ideas?

Posted via http://www.ruby-forum.com/.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

popen (on Windows in particular) has had issues, some of which were
fixed post-1.4.0. The recent 1.5.0.RC1 should contain most (if not all)
of these, so please give that a try.

Hiro

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

While I have you here … If I execute an external process … ant
script … and that script sleeps but then finishes … the command
never returns but just hangs. I’ve tried exec and system and they all do
the same thing if an external process sleeps. Any ideas there?

Christopher Dancy wrote:

While I have you here … If I execute an external process … ant
script … and that script sleeps but then finishes … the command
never returns but just hangs. I’ve tried exec and system and they all do
the same thing if an external process sleeps. Any ideas there?

Is that RC1 a release candidate or is it suitable for development?

Christopher Dancy wrote:

Christopher Dancy wrote:

While I have you here … If I execute an external process … ant
script … and that script sleeps but then finishes … the command
never returns but just hangs. I’ve tried exec and system and they all do
the same thing if an external process sleeps. Any ideas there?

Is that RC1 a release candidate or is it suitable for development?

I apologize for anyone reading this thread … it’s not a jruby issue
but an ant one. The ant task I was executing would itself run a batch
file … and that causes a wide array of problems not jruby related.
Either way the problem was solved using the parallel ant task. Sorry
again guys.

Christopher Dancy wrote:

Christopher Dancy wrote:

Christopher Dancy wrote:

While I have you here … If I execute an external process … ant
script … and that script sleeps but then finishes … the command
never returns but just hangs. I’ve tried exec and system and they all do
the same thing if an external process sleeps. Any ideas there?

Is that RC1 a release candidate or is it suitable for development?

I apologize for anyone reading this thread … it’s not a jruby issue
but an ant one. The ant task I was executing would itself run a batch
file … and that causes a wide array of problems not jruby related.
Either way the problem was solved using the parallel ant task. Sorry
again guys.

hahaha sorry but I spoke to soon … its a jruby issue and is resolved
when using jruby 1.5.0RC1. This is my last comment :slight_smile: