Problem with Ruby script output being stored into a file

Posted by nickf on Stack Overflow See other posts from Stack Overflow or by nickf
Published on 2010-05-18T07:35:20Z Indexed on 2010/05/18 7:40 UTC
Read the original article Hit count: 308

Filed under:
|
|
|

I have a Ruby script that outputs a heap of text. As an example:

puts "line 1"
puts "line 2"
puts "line 3"
# etc... (obviously, this isn't how my script works..)

There's not a lot of data - perhaps about 8kb of character data in total.

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 push it into a file, the output is truncated at exactly 4096 bytes:

$ ./my-script.rb > output.txt

What would cause it to stop at 4kb?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about linux