I have a Ruby script that outputs a bunch of text. As an example:
puts "line 1"
puts "line 2"
puts "line 3"
There is not much data here - perhaps about 8 kilobytes of character data.
When I run the script on the command line, it works as expected:
$ ./my-script.rb
line 1
line 2
line 3
But when I insert it into the file, the output is truncated exactly at 4096 bytes:
$ ./my-script.rb > output.txt
What could cause a 4kb stop?
Update: I just rewrote the script to output directly to a file, instead of typing on the screen and fixing the output, and the problem is still happening!
$output = File.new("file.txt")
$output << "line 1"
nickf source
share