lib/remote_table/file.rb in remote_table-0.2.16 vs lib/remote_table/file.rb in remote_table-0.2.17
- old
+ new
@@ -57,32 +57,32 @@
FileUtils.cp path, "#{path}.backup"
end
def skip_rows!
return unless skip
- `cat #{path} | tail -n +#{skip + 1} > #{path}.tmp`
+ RemoteTable.backtick_with_reporting "cat #{path} | tail -n +#{skip + 1} > #{path}.tmp"
FileUtils.mv "#{path}.tmp", path
end
def convert_file_to_utf8!
return if encoding == 'UTF-8' or encoding == 'UTF8'
- `iconv -c -f #{encoding} -t UTF-8 #{path} > #{path}.tmp`
+ RemoteTable.backtick_with_reporting "iconv -c -f #{encoding} -t UTF-8 #{path} > #{path}.tmp"
FileUtils.mv "#{path}.tmp", path
end
def restore_file!
FileUtils.mv "#{path}.backup", path if ::File.readable? "#{path}.backup"
end
def cut_columns!
return unless cut
- `cat #{path} | cut -c #{cut} > #{path}.tmp`
+ RemoteTable.backtick_with_reporting "cat #{path} | cut -c #{cut} > #{path}.tmp"
FileUtils.mv "#{path}.tmp", path
end
def crop_rows!
return unless crop
- `cat #{path} | tail -n +#{crop.first} | head -n #{crop.last - crop.first + 1} > #{path}.tmp`
+ RemoteTable.backtick_with_reporting "cat #{path} | tail -n +#{crop.first} | head -n #{crop.last - crop.first + 1} > #{path}.tmp"
FileUtils.mv "#{path}.tmp", path
end
def format_from_filename
extname = ::File.extname(filename).gsub('.', '')