methodmissing / eio

A libeio (http://software.schmorp.de/pkg/libeio.html) wrapper for Ruby
http://github.com/methodmissing/eio
Other
29 stars 0 forks source link

`write': string contains null byte (ArgumentError) #5

Open dualsoul opened 12 years ago

dualsoul commented 12 years ago

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