# File lib/childprocess/windows/functions.rb, line 66 def self.handle_for(fd_or_io) case fd_or_io when IO handle = get_osfhandle(fd.fileno) when Fixnum handle = get_osfhandle(fd_or_io) else if fd_or_io.respond_to?(:to_io) io = fd_or_io.to_io unless io.kind_of?(IO) raise TypeError, "expected #to_io to return an instance of IO" end handle = get_osfhandle(io.fileno) else raise TypeError, "invalid type: #{fd_or_io.inspect}" end end if handle == INVALID_HANDLE_VALUE raise Error, last_error_message end handle end