Problem talking to processes. JRuby's read hangs.
-------------------------------------------------

                 Key: JRUBY-1304
                 URL: http://jira.codehaus.org/browse/JRUBY-1304
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.0.0
         Environment: Tested on OSX/Intel (JDK 1.5) and Windows (JDK 1.6)
            Reporter: Mariano Kamp


>From my email 
>(http://www.nabble.com/Problem-when-talking-to-processes--tf4354724.html#a12408771):

Hi, 

   I am currently trying to make a rails application run on JRuby.   
Most of my problems have vanished by now (using an http-proxy and   
Windows really is a lot harder than OSX), but talking to processes   
doesn't work all that well for me, or to be more specific to the   
graphviz library by using pipes. 

   I extracted the problem to get a small sample. Calling grep,   
passing in some lines via stdin and the reading stdout: 

source = <<-DOC 
one 
two 
three 
four 
five 
DOC 

puts "Now calling grep" 
output = IO.popen('grep e', 'r+') do |process| 
     process.puts source 
     process.close_write 
     process.read 
   end 

puts "And we're back: #{output}" 

   This works fine with Ruby but hangs JRuby. 

localhost:~ mkamp$ uname -a 
Darwin localhost 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23   
16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386 i386 i386 
localhost:~ mkamp$ ruby -v 
ruby 1.8.5 (2006-08-25) [i686-darwin8.8.3] 
localhost:~ mkamp$ jruby -v 
ruby 1.8.5 (2007-08-13 rev 3876) [i386-jruby1.1] 
localhost:~ mkamp$ java -version 
java version "1.5.0_07" 
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164) 
Java HotSpot(TM) Client VM (build 1.5.0_07-87, mixed mode, sharing) 
localhost:~ mkamp$ ruby talking_to_processes.rb 
Now calling grep 
And we're back: one 
three 
five 
localhost:~ mkamp$ jruby talking_to_processes.rb 
Now calling grep 

   JRuby hangs at "process.read" ... 

   Any idea why that is? Should I report a bug? I didn't find a   
relevant open one in Core Classes/Modules. http://jira.codehaus.org/  
browse/JRUBY-1049 
  is the closest I've seen, but I don't get "NoMethodError". 

   I am running JRuby from the trunk. This behavior can be seen on   
OSX and Windows. 

Cheers, 
Mariano 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to