summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2021-05-18 15:21:50 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2021-05-18 19:15:24 +0200
commit4c6ad5705584f9d76a67b0688ba66aef2eca66dc (patch)
treecc08736c7704d7f468930c67f0f1281bde9716a6
parent0ad417b315cb1259a2943b84edba602d3ddacfa4 (diff)
utils/ps.c: Don't limit output width to 80 on non-tty
If no output width limit has been set explicitly, and we're not printing to a tty, do not limit output width. In particular, this fixes grepping ps output. Message-Id: <20210518122150.1490468-1-bugaevc@gmail.com>
-rw-r--r--utils/ps.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/utils/ps.c b/utils/ps.c
index 2cf6e4bd..d6c55f7e 100644
--- a/utils/ps.c
+++ b/utils/ps.c
@@ -367,6 +367,11 @@ main(int argc, char *argv[])
/* Parse our command line. This shouldn't ever return an error. */
argp_parse (&argp, argc, argv, 0, 0, 0);
+ /* If no output width limit has been set explicitly, and we're not printing
+ to a tty, do not limit output width. */
+ if (output_width == -1 && !isatty (STDOUT_FILENO))
+ output_width = 0;
+
msgids_scan_std ();
err = proc_stat_list_create(context, &procset);