for example:
$ findmnt | cat
$ lslocks > foo
the output should not be truncated.
Signed-off-by: Karel Zak <kzak@redhat.com>
struct tt {
size_t ncols; /* number of columns */
size_t termwidth; /* terminal width */
+ int is_term; /* is a tty? */
int flags;
int first_run;
extremes += cl->is_extreme;
}
+ if (!tb->is_term)
+ return;
+
/* reduce columns with extreme fields
*/
if (width > tb->termwidth && extremes) {
if (!tb)
return -1;
- if (tb->first_run && !tb->termwidth) {
- tb->termwidth = get_terminal_width();
+ if (tb->first_run) {
+ tb->is_term = isatty(STDOUT_FILENO);
+
+ if (tb->is_term && !tb->termwidth)
+ tb->termwidth = get_terminal_width();
if (tb->termwidth <= 0)
tb->termwidth = 80;
}