Looping through tar file

Hi,

I want to loop through foo.tgz file using the Minitar gem.
When I run my script through Ruby on Rails console the following code
will print entire file names no matter how long they are, but when I run
the same code from terminal using plain ruby script it prints only the
first 100 characters of the name cutting off the rest.
The same happens when trying to store the output into variable.

require ‘fileutils’
require ‘zlib’
require ‘archive/tar/minitar’

tgz = Zlib::GzipReader.new(File.open(file.path))
tar = Minitar::Reader.new(tgz)

tar.each_entry do |rec|
print rec.name
end

Anyone has an idea how to get the whole file name in ruby script or what
could be causing the different behavior?

Thanks,

Ondrej

Perhaps the Rails console is wrapping the output and the terminal isn’t?

Any idea how to change terminal settings so the whole string is
preserved? Tried to google that but no luck

Thanks

    1. 2014 v 12:26, Joel P. [email protected]:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs