cli/new: Avoid printing "\033[K" to non-terminal output
authorŁukasz Stelmach <l.stelmach@samsung.com>
Thu, 2 Mar 2017 12:22:01 +0000 (13:22 +0100)
committerDavid Bremner <david@tethera.net>
Thu, 9 Mar 2017 14:17:12 +0000 (10:17 -0400)
notmuch-new.c

index 13212639cc8ec669df4ea3d47f6c0d4d9a3fd834..e2822e23060786ee9674e3d9371cec44782315ba 100644 (file)
@@ -905,10 +905,9 @@ print_results (const add_files_state_t *state)
                state->processed_files == 1 ? "file" : "total files");
        notmuch_time_print_formatted_seconds (elapsed);
        if (elapsed > 1)
-           printf (" (%d files/sec.).\033[K\n",
+           printf (" (%d files/sec.)",
                    (int) (state->processed_files / elapsed));
-       else
-           printf (".\033[K\n");
+       printf (".%s\n", (state->output_is_a_tty) ? "\033[K" : "");
     }
 
     if (state->added_messages)