diff options
author | jake <jake@jakes-mail.top> | 2022-01-29 12:11:06 -0500 |
---|---|---|
committer | jake <jake@jakes-mail.top> | 2022-01-29 12:11:06 -0500 |
commit | d7ba1380e1da738d1e614757e3a6308a891ef2ef (patch) | |
tree | 9c662ca4d78a3a210ebe95e856eae9e391ff5797 /gmi.pl | |
parent | b7a9e5544f5dd7e6f983625a485ff8fa46af80ae (diff) |
display() fix when pipe errors on big docs
Diffstat (limited to 'gmi.pl')
-rwxr-xr-x | gmi.pl | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -686,16 +686,22 @@ sub display { $wrapper->columns($wc); } if ($use_pager) { - IO::Pager::open(my $FH) or warn($!); - for (@doc) { - _pre_block($_); - if ($pre_block) { - print $FH $_; - } - else { - print $FH $wrapper->wrap($_); + ### opening IO Pager + eval { + # catch it or big files ( >1000 lines ) will load but the script itself dies for some reason + local $SIG{PIPE} = sub { die }; + IO::Pager::open(my $FH) or warn($!); + for (@doc) { + _pre_block($_); + if ($pre_block) { + print $FH $_; + } + else { + print $FH $wrapper->wrap($_); + } } - } + close $FH; + }; } else { for (@doc) { |