aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/ps.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 0d79b5cb..f6906716 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -1149,8 +1149,10 @@ static void shared_main(void)
TT.width = 80;
TT.height = 25;
// If ps can't query terminal size pad to 80 but do -w
- if (!terminal_size(&TT.width, &TT.height) && toys.which->name[1] == 's')
- toys.optflags |= FLAG_w;
+ if (toys.which->name[1] == 's') {
+ if (!isatty(1) || !terminal_size(&TT.width, &TT.height))
+ toys.optflags |= FLAG_w;
+ }
}
// find controlling tty, falling back to /dev/tty if none