aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-new.c
diff options
context:
space:
mode:
authorGravatar Chris Wilson <chris@chris-wilson.co.uk>2009-11-22 00:44:32 +0000
committerGravatar Carl Worth <cworth@cworth.org>2009-11-22 05:36:39 +0100
commit018ca890a3e6ca1cb1068fd789674e475c4a285f (patch)
treeb4e16080361707ba0c3d7329a3bf60ac29bbbcc3 /notmuch-new.c
parent986f6c98244610da6bba88d0c92895b9758973ee (diff)
notmuch-new: Only print the regular progress report when on a tty
Check that the stdout is connected to an interactive terminal with isatty() before installing the periodic timer to print progress reports. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'notmuch-new.c')
-rw-r--r--notmuch-new.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/notmuch-new.c b/notmuch-new.c
index 1616ee96..0dd27844 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -20,6 +20,8 @@
#include "notmuch-client.h"
+#include <unistd.h>
+
static volatile sig_atomic_t do_add_files_print_progress = 0;
static void
@@ -273,7 +275,7 @@ add_files (notmuch_database_t *notmuch,
}
/* Setup our handler for SIGALRM */
- if (! debugger_is_active ()) {
+ if (isatty (fileno (stdout)) && ! debugger_is_active ()) {
memset (&action, 0, sizeof (struct sigaction));
action.sa_handler = handle_sigalrm;
sigemptyset (&action.sa_mask);