module ExecSandbox::Spawn::RubyVM

Maps an internal MRI function that we need.

Public Class Methods

rb_reserved_fd_p(fd) click to toggle source

Emulation of internal MRI function.

This is a fallback, used in case FFI can’t find the MRI function.

# File lib/exec_sandbox/spawn.rb, line 175
def self.rb_reserved_fd_p(fd)
  begin
    # This fails if rb_reserved_fd_p returns a non-zero value.
    IO.new fd
    return 0
  rescue ArgumentError, Errno::EBADF
    return 1
  end
end