Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
strategy:
matrix:
ruby: [ 3.0, 2.7, head ]
ruby: [ 3.0, 2.7, head, truffleruby, truffleruby-head, jruby, jruby-head ]
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
Expand Down
13 changes: 9 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ require "rake/testtask"

name = "io/nonblock"

require 'rake/extensiontask'
extask = Rake::ExtensionTask.new(name) do |x|
x.lib_dir.sub!(%r[(?=/|\z)], "/#{RUBY_VERSION}/#{x.platform}")
if RUBY_ENGINE == 'ruby'
require 'rake/extensiontask'
extask = Rake::ExtensionTask.new(name) do |x|
x.lib_dir.sub!(%r[(?=/|\z)], "/#{RUBY_VERSION}/#{x.platform}")
end
else
task :compile
end

Rake::TestTask.new(:test) do |t|
t.libs = ["lib/#{RUBY_VERSION}/#{extask.platform}"]
t.libs = ["lib/#{RUBY_VERSION}/#{extask.platform}"] if extask
t.libs << "test/lib"
t.ruby_opts << "-rhelper"
t.test_files = FileList["test/**/test_*.rb"]
Expand Down
5 changes: 5 additions & 0 deletions ext/io/nonblock/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
require 'mkmf'
target = "io/nonblock"

unless RUBY_ENGINE == 'ruby'
File.write("Makefile", dummy_makefile($srcdir).join(""))
return
end

have_func("rb_io_descriptor")

hdr = %w"fcntl.h"
Expand Down
3 changes: 2 additions & 1 deletion ext/io/nonblock/nonblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@

#ifndef HAVE_RB_IO_DESCRIPTOR
static int
rb_io_descriptor(VALUE io)
io_descriptor_fallback(VALUE io)
{
rb_io_t *fptr;
GetOpenFile(io, fptr);
return fptr->fd;
}
#define rb_io_descriptor io_descriptor_fallback
#endif

#ifdef F_GETFL
Expand Down