Skip to content

unexpected break (from proc-closure) terminates process #4036

Open
@kares

Description

MRI :

2.3.1 :001 >     proc = Proc.new { puts "HELLO"; break; puts "AGAIN" }
 => #<Proc:0x000000013f9958@(irb):1> 
2.3.1 :002 >     proc.call; puts "proc called"
HELLO
LocalJumpError: break from proc-closure
    from (irb):1:in `block in irb_binding'
    from (irb):2
    from /opt/local/rvm/rubies/ruby-2.3.1/bin/irb:11:in `<main>'
2.3.1 :003 > exit
jruby-1.7.24 :029 > proc = Proc.new { puts "HELLO"; break; puts "AGAIN" }
 => #<Proc:0xe874448@(irb):29> 
jruby-1.7.24 :030 > proc.call; puts "proc called"
HELLO
LocalJumpError: break from proc-closure
    from org/jruby/RubyProc.java:281:in `call'
    from (irb):30:in `evaluate'
    from org/jruby/RubyKernel.java:1079:in `eval'
    from org/jruby/RubyKernel.java:1479:in `loop'
    from org/jruby/RubyKernel.java:1242:in `catch'
    from org/jruby/RubyKernel.java:1242:in `catch'
    from /opt/local/rvm/rubies/jruby-1.7.24/bin/irb:13:in `(root)'
jruby-1.7.24 :031 > 
jruby-1.7.24 :032 >   exit

but 9K does not work the same :

jruby-9.1.2.0 :001 >     proc = Proc.new { puts "HELLO"; break; puts "AGAIN" }
 => #<Proc:0x31368b99@(irb):1> 
jruby-9.1.2.0 :002 >     proc.call; puts "proc called"
HELLO
LocalJumpError: unexpected break

... IRBreakJump bubbles up to Main#main's catch (Throwable) ...

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions