[notmuch] [PATCH 2/2] notmuch-new: Only print the regular progress report when on...
authorChris Wilson <chris@chris-wilson.co.uk>
Sun, 22 Nov 2009 00:44:32 +0000 (00:44 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:38 +0000 (09:35 -0800)
4c/1094a1fce8518c3f390bbd3986dd6b2e151e63 [new file with mode: 0644]

diff --git a/4c/1094a1fce8518c3f390bbd3986dd6b2e151e63 b/4c/1094a1fce8518c3f390bbd3986dd6b2e151e63
new file mode 100644 (file)
index 0000000..5cf3d58
--- /dev/null
@@ -0,0 +1,76 @@
+Return-Path: <chris@chris-wilson.co.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 2779A431FC3\r
+       for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 16:44:43 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id w4A-n-S20vtV for <notmuch@notmuchmail.org>;\r
+       Sat, 21 Nov 2009 16:44:42 -0800 (PST)\r
+Received: from orsmga101.jf.intel.com (mga06.intel.com [134.134.136.21])\r
+       by olra.theworths.org (Postfix) with ESMTP id A813C431FC4\r
+       for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 16:44:40 -0800 (PST)\r
+Received: from orsmga002.jf.intel.com ([10.7.209.21])\r
+       by orsmga101.jf.intel.com with ESMTP; 21 Nov 2009 16:44:32 -0800\r
+X-ExtLoop1: 1\r
+X-IronPort-AV: E=Sophos;i="4.47,265,1257148800"; d="scan'208";a="469444045"\r
+Received: from unknown (HELO localhost.localdomain) ([10.255.16.190])\r
+       by orsmga002.jf.intel.com with ESMTP; 21 Nov 2009 17:01:42 -0800\r
+From: Chris Wilson <chris@chris-wilson.co.uk>\r
+To: notmuch@notmuchmail.org\r
+Date: Sun, 22 Nov 2009 00:44:32 +0000\r
+Message-Id: <1258850672-28339-3-git-send-email-chris@chris-wilson.co.uk>\r
+X-Mailer: git-send-email 1.6.5.3\r
+In-Reply-To: <1258850672-28339-1-git-send-email-chris@chris-wilson.co.uk>\r
+References: <1258850672-28339-1-git-send-email-chris@chris-wilson.co.uk>\r
+Subject: [notmuch] [PATCH 2/2] notmuch-new: Only print the regular progress\r
+       report when on a tty\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 22 Nov 2009 00:44:43 -0000\r
+\r
+Check that the stdout is connected to an interactive terminal with\r
+isatty() before installing the periodic timer to print progress reports.\r
+\r
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>\r
+---\r
+ notmuch-new.c |    4 +++-\r
+ 1 files changed, 3 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/notmuch-new.c b/notmuch-new.c\r
+index 1616ee9..0dd2784 100644\r
+--- a/notmuch-new.c\r
++++ b/notmuch-new.c\r
+@@ -20,6 +20,8 @@\r
\r
+ #include "notmuch-client.h"\r
\r
++#include <unistd.h>\r
++\r
+ static volatile sig_atomic_t do_add_files_print_progress = 0;\r
\r
+ static void\r
+@@ -273,7 +275,7 @@ add_files (notmuch_database_t *notmuch,\r
+     }\r
\r
+     /* Setup our handler for SIGALRM */\r
+-    if (! debugger_is_active ()) {\r
++    if (isatty (fileno (stdout)) && ! debugger_is_active ()) {\r
+       memset (&action, 0, sizeof (struct sigaction));\r
+       action.sa_handler = handle_sigalrm;\r
+       sigemptyset (&action.sa_mask);\r
+-- \r
+1.6.5.3\r
+\r