[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] utils/ps.c: Don't limit output width to 80 on non-tty
From: |
Sergey Bugaev |
Subject: |
[PATCH] utils/ps.c: Don't limit output width to 80 on non-tty |
Date: |
Tue, 18 May 2021 15:21:50 +0300 |
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.
---
utils/ps.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/utils/ps.c b/utils/ps.c
index 2cf6e4bd..8e39c2c5 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 (1))
+ output_width = 0;
+
msgids_scan_std ();
err = proc_stat_list_create(context, &procset);
--
2.31.1
- [PATCH] utils/ps.c: Don't limit output width to 80 on non-tty,
Sergey Bugaev <=