Skip to content

Process.spawn with IO.pipe output fails on Java 21 + warbler #569

@kalenp

Description

@kalenp

Using Open3.capture3 fails when running with java21 from a warbler jar with

ERROR: org.jruby.embed.EvalFailedException: (EBADF) Bad file descriptor - ls

This works correctly with java 11 and warbler, or with java 21 and no warbler. This is tested on jruby 9.4.12 and warbler 2.0.5.

I simplified the Open3 code down to this repro:

out_r, out_w = IO.pipe

pid = spawn('ls', out: out_w)

wait_thr = Process.detach(pid)
out_w.close
begin
  out_reader = Thread.new { out_r.read }
  output = out_reader.value
  puts output
ensure
  out_r.close
  wait_thr.join
end

When running this, it will fail at spawn. Spawning without an output pipe works fine in the java21+warbler configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions