Skip to content

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

@dualsoul

Description

@dualsoul

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions