--- /dev/null
+Return-Path: <m.walters@qmul.ac.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 2DB36431FAF\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 02:05:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\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 KG9kmXEfnmbt for <notmuch@notmuchmail.org>;\r
+ Sat, 25 May 2013 02:04:53 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id DC817431FAE\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 02:04:52 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1UgAP4-0002Hr-K2; Sat, 25 May 2013 10:04:49 +0100\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1UgAP4-00047M-BG; Sat, 25 May 2013 10:04:42 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/4] cli: add global option --stderr=FILE\r
+In-Reply-To: <1369332362-4719-1-git-send-email-tomi.ollila@iki.fi>\r
+References: <1369332362-4719-1-git-send-email-tomi.ollila@iki.fi>\r
+User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sat, 25 May 2013 10:04:41 +0100\r
+Message-ID: <8738tbph06.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 3427afa8f305b766055ca239a5bcb0fa (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Sat, 25 May 2013 09:05:01 -0000\r
+\r
+\r
+This series looks good to me and it does simplify the emacs async error\r
+handling very usefully. +1\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+On Thu, 23 May 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> With this option all writes to stderr are redirected to the spesified\r
+> FILE (or to stdout on case FILE is '-'). This is immediately useful\r
+> in emacs interface as some of its exec intefaces do not provide\r
+> separation of stdout and stderr.\r
+> ---\r
+> notmuch-client.h | 1 +\r
+> notmuch.c | 31 +++++++++++++++++++++++++++++++\r
+> 2 files changed, 32 insertions(+)\r
+>\r
+> diff --git a/notmuch-client.h b/notmuch-client.h\r
+> index 45749a6..4a3c7ac 100644\r
+> --- a/notmuch-client.h\r
+> +++ b/notmuch-client.h\r
+> @@ -54,6 +54,7 @@ typedef GMimeCipherContext notmuch_crypto_context_t;\r
+> #include <sys/stat.h>\r
+> #include <sys/time.h>\r
+> #include <unistd.h>\r
+> +#include <fcntl.h>\r
+> #include <dirent.h>\r
+> #include <errno.h>\r
+> #include <signal.h>\r
+> diff --git a/notmuch.c b/notmuch.c\r
+> index f51a84f..77b5282 100644\r
+> --- a/notmuch.c\r
+> +++ b/notmuch.c\r
+> @@ -251,6 +251,31 @@ notmuch_command (notmuch_config_t *config,\r
+> return 0;\r
+> }\r
+> \r
+> +static int redirect_stderr (const char * stderr_file)\r
+> +{\r
+> + if (strcmp (stderr_file, "-") == 0) {\r
+> + if (dup2 (STDOUT_FILENO, STDERR_FILENO) < 0) {\r
+> + perror ("dup2");\r
+> + return 1;\r
+> + }\r
+> + } else {\r
+> + int fd = open (stderr_file, O_WRONLY|O_CREAT|O_APPEND, 0644);\r
+> + if (fd < 0) {\r
+> + fprintf (stderr, "Error: Cannot redirect stderr to '%s': %s\n",\r
+> + stderr_file, strerror (errno));\r
+> + return 1;\r
+> + }\r
+> + if (fd != STDERR_FILENO) {\r
+> + if (dup2 (fd, STDERR_FILENO) < 0) {\r
+> + perror ("dup2");\r
+> + return 1;\r
+> + }\r
+> + close (fd);\r
+> + }\r
+> + }\r
+> + return 0;\r
+> +}\r
+> +\r
+> int\r
+> main (int argc, char *argv[])\r
+> {\r
+> @@ -259,6 +284,7 @@ main (int argc, char *argv[])\r
+> const char *command_name = NULL;\r
+> command_t *command;\r
+> char *config_file_name = NULL;\r
+> + char *stderr_file = NULL;\r
+> notmuch_config_t *config;\r
+> notmuch_bool_t print_help=FALSE, print_version=FALSE;\r
+> int opt_index;\r
+> @@ -268,6 +294,7 @@ main (int argc, char *argv[])\r
+> { NOTMUCH_OPT_BOOLEAN, &print_help, "help", 'h', 0 },\r
+> { NOTMUCH_OPT_BOOLEAN, &print_version, "version", 'v', 0 },\r
+> { NOTMUCH_OPT_STRING, &config_file_name, "config", 'c', 0 },\r
+> + { NOTMUCH_OPT_STRING, &stderr_file, "stderr", '\0', 0 },\r
+> { 0, 0, 0, 0, 0 }\r
+> };\r
+> \r
+> @@ -287,6 +314,10 @@ main (int argc, char *argv[])\r
+> return 1;\r
+> }\r
+> \r
+> + if (stderr_file && redirect_stderr (stderr_file) != 0) {\r
+> + /* error already printed */\r
+> + return 1;\r
+> + }\r
+> if (print_help)\r
+> return notmuch_help_command (NULL, argc - 1, &argv[1]);\r
+> \r
+> -- \r
+> 1.8.1.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r