Skip to content

IO.popen does not return value of the provided block #8278

@dub357

Description

@dub357

According to the Ruby docs, if a block is provided to IO.popen, the value returned from the block becomes the value returned from the popen method. In JRuby, this is never true and the IO object itself is always returned. CRuby/MRI returns the value of the block as expected.

Environment Information

  • jruby 9.4.7.0 (3.1.4) 2024-04-29 597ff08 Java HotSpot(TM) 64-Bit Server VM 25.181-b13 on 1.8.0_181-b13 +jit [x86_64-mswin32]
  • windows 10 enterprise

Expected Behavior

jruby-9.4.7.0\bin>.\jruby.exe -e "puts IO.popen('echo test')"
test

Actual Behavior

jruby-9.4.7.0\bin>.\jruby.exe -e "puts IO.popen('echo test')"
#<IO:0x1b11171f>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions