Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2779A431FC3 for ; Sat, 21 Nov 2009 16:44:43 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w4A-n-S20vtV for ; Sat, 21 Nov 2009 16:44:42 -0800 (PST) Received: from orsmga101.jf.intel.com (mga06.intel.com [134.134.136.21]) by olra.theworths.org (Postfix) with ESMTP id A813C431FC4 for ; Sat, 21 Nov 2009 16:44:40 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 21 Nov 2009 16:44:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.47,265,1257148800"; d="scan'208";a="469444045" Received: from unknown (HELO localhost.localdomain) ([10.255.16.190]) by orsmga002.jf.intel.com with ESMTP; 21 Nov 2009 17:01:42 -0800 From: Chris Wilson To: notmuch@notmuchmail.org Date: Sun, 22 Nov 2009 00:44:32 +0000 Message-Id: <1258850672-28339-3-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: <1258850672-28339-1-git-send-email-chris@chris-wilson.co.uk> References: <1258850672-28339-1-git-send-email-chris@chris-wilson.co.uk> Subject: [notmuch] [PATCH 2/2] notmuch-new: Only print the regular progress report when on a tty X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Nov 2009 00:44:43 -0000 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 --- notmuch-new.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index 1616ee9..0dd2784 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -20,6 +20,8 @@ #include "notmuch-client.h" +#include + 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); -- 1.6.5.3