Commit 1019ed5758d97da4a3376da3af1f38a7b99dc93f
1 parent
18b34a56
Fix to TestDriver.pm (qtest)
Showing
1 changed file
with
11 additions
and
1 deletions
qtest/module/TestDriver.pm
| ... | ... | @@ -118,7 +118,13 @@ sub get_tty_features |
| 118 | 118 | eval |
| 119 | 119 | { |
| 120 | 120 | require Term::ReadKey; |
| 121 | - ($ncols, undef, undef, undef) = Term::ReadKey::GetTerminalSize(); | |
| 121 | + if (-t STDOUT) | |
| 122 | + { | |
| 123 | + # This prints error messages if STDOUT is not a tty, so | |
| 124 | + # check even if -stdout-tty=1 was given. | |
| 125 | + ($ncols, undef, undef, undef) = | |
| 126 | + Term::ReadKey::GetTerminalSize(\*STDOUT); | |
| 127 | + } | |
| 122 | 128 | $got_size = 1; |
| 123 | 129 | }; |
| 124 | 130 | if (! $got_size) |
| ... | ... | @@ -145,6 +151,10 @@ sub get_tty_features |
| 145 | 151 | } |
| 146 | 152 | }; |
| 147 | 153 | } |
| 154 | + if (! defined $ncols) | |
| 155 | + { | |
| 156 | + $ncols = 80; | |
| 157 | + } | |
| 148 | 158 | eval |
| 149 | 159 | { |
| 150 | 160 | if ($in_windows) | ... | ... |