From e9693f8c938770bb396c963de6c40fc817285276 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Tue, 10 Jul 2012 11:59:20 +0200 Subject: [PATCH] Bug #1344: Handle CLI output of many lines to a pipe --- src/cli/cli_helper.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/cli/cli_helper.rb b/src/cli/cli_helper.rb index 9e78d291d0..92d6c241b1 100644 --- a/src/cli/cli_helper.rb +++ b/src/cli/cli_helper.rb @@ -168,13 +168,18 @@ module CLIHelper def print_data(data, options) ncolumns=@default_columns.length res_data=data_array(data, options) - print res_data.collect{|l| - (0..ncolumns-1).collect{ |i| - dat=l[i] - col=@default_columns[i] - format_str(col, dat) - }.join(' ') - }.join("\n") + + begin + print res_data.collect{|l| + (0..ncolumns-1).collect{ |i| + dat=l[i] + col=@default_columns[i] + format_str(col, dat) + }.join(' ') + }.join("\n") + rescue Errno::EPIPE + end + puts end