`exec': string contains null byte (ArgumentError)
cmd string has got a null (i.e. zero) byte in it somehow. Using
puts won’t show up any null bytes, they’ll just be left out of the output:
1.8.7 :001 > exec "\0"
ArgumentError: string contains null byte
from (irb):1:in `exec'
1.8.7 :002 > puts "n\0n"
You should probably check how your
pxs variables are being populated to see if you can track down the source of these null bytes, but as a quick fix you could use
gsub! to remove them:
ArgumentError: string contains null byte when writing Marshalled data into a file
The order of the file name and content argument is reversed. The first argument must be the name and the second one the content. The argument error is raised because file names shouldn't contain null bytes.
And since you're dealing with binary data, you should use
File.binwrite "users.txt", Marshal.dump(users)
Can't run logstash. pathname contains null byte
it seems you have non-printing character in your config file.
cat -vET /usr/share/logstash/bin/logstash.conf
Write string with null characters to stdin of program
This is not a ruby-specific problem. Arguments on a nix system are passed as null-terminated strings (see
exec(2) for more details). That means null characters are the one type of characters arguments to any command can't have. You'll need to think of a way of passing the null-containing message in a different way than via arguments. (stdin would probably be the simplest alternative).