Kernel.trap does not work on MacOS X Lion
-----------------------------------------

                 Key: JRUBY-6012
                 URL: https://jira.codehaus.org/browse/JRUBY-6012
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6.3, JRuby 1.6.2
         Environment: MacOS X Lion 10.7.1
rvm 1.7.2
JRuby 1.6.3
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
            Reporter: Sergey Kuznetsov
            Assignee: Thomas E Enebo


I have found a strange behavior when trying to restart rails app. Webrick shows 
me that default port 3000 is already binded, to restart I need to "ps ax | grep 
java" and kill -9 this process.

After some googling and researching I have found that JRuby doesn't properly 
work with Kernel.trap method on my laptop (Mac OS X Lion 10.7.1, rvm 1.7.2, 
jruby 1.6.3, Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511c).

Here is some ruby code to test described behavior (some.rb):

        Kernel.trap(:INT) { puts "interrupted = true"; exit }

        loop do
          puts ". "
          sleep 1
        end

And here is steps to reproduce:

        $ rvm use ree
        Using /Users/cr0t/.rvm/gems/ree-1.8.7-2011.03
        
        $ ruby some.rb 
        . 
        . 
        ^Cinterrupted = true
                
We can see that block given to the trap method is executed successfully 
("interrupted = true" printed out before exiting), so next we will try to run 
code above via JRuby interpreter.

        $ rvm use jruby
        Using /Users/cr0t/.rvm/gems/jruby-1.6.3
        $ ruby some.rb 
        . 
        . 
        ^C

        $ rvm version

        rvm 1.7.2 by Wayne E. Seguin (wayneeseg...@gmail.com) 
[https://rvm.beginrescueend.com/]

Could anyone help to fix this issue (it's really annoying when working with 
rails)? Or anyone who can reproduce such behavior?

--
This message is automatically generated by JIRA.
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