commit ebdb45dde4984e7ccd471b226ed99c44b6793569
parent 157a1a7bee19b2835f270ebf1591bfbef4855868
Author: Kyle Milz <kyle@getaddrinfo.net>
Date: Thu, 12 Mar 2015 02:01:33 -0600
PriceChart: only try to get terminal width when we are a terminal
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/PriceChart.pm b/PriceChart.pm
@@ -133,7 +133,11 @@ sub trunc_line
my $line = shift;
my $prefix = shift || 0;
- my ($term_width) = Term::ReadKey::GetTerminalSize();
+ my $term_width = 80;
+ if (POSIX::isatty(STDOUT)) {
+ ($term_width) = Term::ReadKey::GetTerminalSize();
+ }
+
my $len = $term_width - $prefix - 3;
if (length($line) < $len) {
return $line;