Below is a snippet which fails with:
./async_write.rb:8:in write': string contains null byte (ArgumentError) from ./async_write.rb:8:inblock (2 levels) in '
from /usr/local/lib/ruby/gems/1.9.1/gems/eio-0.1/lib/eio/eventmachine.rb:13:in call' from /usr/local/lib/ruby/gems/1.9.1/gems/eio-0.1/lib/eio/eventmachine.rb:13:inpoll'
from /usr/local/lib/ruby/gems/1.9.1/gems/eio-0.1/lib/eio/eventmachine.rb:13:in notify_readable' from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/eventmachine.rb:179:inrun_machine'
from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/eventmachine.rb:179:in run' from ./async_write.rb:4:in'
====== async_write.rb =======
require 'eventmachine'
require 'eio/eventmachine'
EM.run do
EIO.eventmachine_handler
EIO.open("./test.txt", EIO::RDWR|EIO::CREAT) do |fd|
EIO.write(fd, "buf contents: \0hello") do |b| # put the zero byte using \0
EM.stop_event_loop
end
end
end
The issue is taken from: https://groups.google.com/forum/#!msg/eventmachine/oK74Pc92TvE/TX2lU0QvrBkJ
Below is a snippet which fails with: ./async_write.rb:8:in'
from /usr/local/lib/ruby/gems/1.9.1/gems/eio-0.1/lib/eio/eventmachine.rb:13:in '
write': string contains null byte (ArgumentError) from ./async_write.rb:8:in
block (2 levels) incall' from /usr/local/lib/ruby/gems/1.9.1/gems/eio-0.1/lib/eio/eventmachine.rb:13:in
poll' from /usr/local/lib/ruby/gems/1.9.1/gems/eio-0.1/lib/eio/eventmachine.rb:13:innotify_readable' from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/eventmachine.rb:179:in
run_machine' from /usr/local/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.beta.4/lib/eventmachine.rb:179:inrun' from ./async_write.rb:4:in
====== async_write.rb =======
require 'eventmachine' require 'eio/eventmachine'
EM.run do EIO.eventmachine_handler
EIO.open("./test.txt", EIO::RDWR|EIO::CREAT) do |fd| EIO.write(fd, "buf contents: \0hello") do |b| # put the zero byte using \0 EM.stop_event_loop end end end