summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgtop/cgtop.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c
index d04d6f225c..3a2842dac6 100644
--- a/src/cgtop/cgtop.c
+++ b/src/cgtop/cgtop.c
@@ -749,6 +749,10 @@ int main(int argc, char *argv[]) {
if (arg_iterations && iteration >= arg_iterations)
break;
+ if (!on_tty()) /* non-TTY: Empty newline as delimiter between polls */
+ fputs("\n", stdout);
+ fflush(stdout);
+
if (arg_batch) {
usleep(last_refresh + arg_delay - t);
} else {
@@ -762,8 +766,10 @@ int main(int argc, char *argv[]) {
}
}
- fputs("\r \r", stdout);
- fflush(stdout);
+ if (on_tty()) { /* TTY: Clear any user keystroke */
+ fputs("\r \r", stdout);
+ fflush(stdout);
+ }
if (arg_batch)
continue;