sleepy_penguin.git  about / heads / tags
Linux I/O events for Ruby
blob fa5358031fbdb016bc17d41be564bc09cd9e9407 390 bytes (raw)
$ git show HEAD:test/helper.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 
$-w = $stdout.sync = $stderr.sync = Thread.abort_on_exception = true
require 'test/unit'
require 'sleepy_penguin'

def check_cloexec(io)
  pipe = IO.pipe
  rbimp = Fcntl::FD_CLOEXEC & pipe[0].fcntl(Fcntl::F_GETFD)
  ours = Fcntl::FD_CLOEXEC & io.fcntl(Fcntl::F_GETFD)
  assert_equal rbimp, ours, "CLOEXEC default does not match Ruby implementation"
ensure
  pipe.each { |io| io.close }
end

git clone https://yhbt.net/sleepy_penguin.git