eio icon indicating copy to clipboard operation
eio copied to clipboard

`write': string contains null byte (ArgumentError)

Open dualsoul opened this issue 13 years ago • 0 comments

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 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

dualsoul avatar Aug 29 '12 17:08 dualsoul