1 Return-Path: <m.walters@qmul.ac.uk>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 2DB36431FAF
\r
6 for <notmuch@notmuchmail.org>; Sat, 25 May 2013 02:05:01 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id KG9kmXEfnmbt for <notmuch@notmuchmail.org>;
\r
17 Sat, 25 May 2013 02:04:53 -0700 (PDT)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id DC817431FAE
\r
22 for <notmuch@notmuchmail.org>; Sat, 25 May 2013 02:04:52 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1UgAP4-0002Hr-K2; Sat, 25 May 2013 10:04:49 +0100
\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)
\r
28 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)
\r
29 (envelope-from <m.walters@qmul.ac.uk>)
\r
30 id 1UgAP4-00047M-BG; Sat, 25 May 2013 10:04:42 +0100
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
\r
33 Subject: Re: [PATCH 1/4] cli: add global option --stderr=FILE
\r
34 In-Reply-To: <1369332362-4719-1-git-send-email-tomi.ollila@iki.fi>
\r
35 References: <1369332362-4719-1-git-send-email-tomi.ollila@iki.fi>
\r
36 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1
\r
37 (x86_64-pc-linux-gnu)
\r
38 Date: Sat, 25 May 2013 10:04:41 +0100
\r
39 Message-ID: <8738tbph06.fsf@qmul.ac.uk>
\r
41 Content-Type: text/plain; charset=us-ascii
\r
42 X-Sender-Host-Address: 93.97.24.31
\r
43 X-QM-SPAM-Info: Sender has good ham record. :)
\r
44 X-QM-Body-MD5: 3427afa8f305b766055ca239a5bcb0fa (of first 20000 bytes)
\r
45 X-SpamAssassin-Score: -0.1
\r
46 X-SpamAssassin-SpamBar: /
\r
47 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
49 spam. We require at least 5.0 points to mark a message as spam.
\r
50 This message scored -0.1 points.
\r
51 Summary of the scoring:
\r
52 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
53 provider * (markwalters1009[at]gmail.com)
\r
54 * -0.1 AWL AWL: From: address is in the auto white-list
\r
55 X-QM-Scan-Virus: ClamAV says the message is clean
\r
56 Cc: tomi.ollila@iki.fi
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Sat, 25 May 2013 09:05:01 -0000
\r
72 This series looks good to me and it does simplify the emacs async error
\r
73 handling very usefully. +1
\r
80 On Thu, 23 May 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:
\r
81 > With this option all writes to stderr are redirected to the spesified
\r
82 > FILE (or to stdout on case FILE is '-'). This is immediately useful
\r
83 > in emacs interface as some of its exec intefaces do not provide
\r
84 > separation of stdout and stderr.
\r
86 > notmuch-client.h | 1 +
\r
87 > notmuch.c | 31 +++++++++++++++++++++++++++++++
\r
88 > 2 files changed, 32 insertions(+)
\r
90 > diff --git a/notmuch-client.h b/notmuch-client.h
\r
91 > index 45749a6..4a3c7ac 100644
\r
92 > --- a/notmuch-client.h
\r
93 > +++ b/notmuch-client.h
\r
94 > @@ -54,6 +54,7 @@ typedef GMimeCipherContext notmuch_crypto_context_t;
\r
95 > #include <sys/stat.h>
\r
96 > #include <sys/time.h>
\r
97 > #include <unistd.h>
\r
98 > +#include <fcntl.h>
\r
99 > #include <dirent.h>
\r
100 > #include <errno.h>
\r
101 > #include <signal.h>
\r
102 > diff --git a/notmuch.c b/notmuch.c
\r
103 > index f51a84f..77b5282 100644
\r
106 > @@ -251,6 +251,31 @@ notmuch_command (notmuch_config_t *config,
\r
110 > +static int redirect_stderr (const char * stderr_file)
\r
112 > + if (strcmp (stderr_file, "-") == 0) {
\r
113 > + if (dup2 (STDOUT_FILENO, STDERR_FILENO) < 0) {
\r
114 > + perror ("dup2");
\r
118 > + int fd = open (stderr_file, O_WRONLY|O_CREAT|O_APPEND, 0644);
\r
120 > + fprintf (stderr, "Error: Cannot redirect stderr to '%s': %s\n",
\r
121 > + stderr_file, strerror (errno));
\r
124 > + if (fd != STDERR_FILENO) {
\r
125 > + if (dup2 (fd, STDERR_FILENO) < 0) {
\r
126 > + perror ("dup2");
\r
136 > main (int argc, char *argv[])
\r
138 > @@ -259,6 +284,7 @@ main (int argc, char *argv[])
\r
139 > const char *command_name = NULL;
\r
140 > command_t *command;
\r
141 > char *config_file_name = NULL;
\r
142 > + char *stderr_file = NULL;
\r
143 > notmuch_config_t *config;
\r
144 > notmuch_bool_t print_help=FALSE, print_version=FALSE;
\r
146 > @@ -268,6 +294,7 @@ main (int argc, char *argv[])
\r
147 > { NOTMUCH_OPT_BOOLEAN, &print_help, "help", 'h', 0 },
\r
148 > { NOTMUCH_OPT_BOOLEAN, &print_version, "version", 'v', 0 },
\r
149 > { NOTMUCH_OPT_STRING, &config_file_name, "config", 'c', 0 },
\r
150 > + { NOTMUCH_OPT_STRING, &stderr_file, "stderr", '\0', 0 },
\r
151 > { 0, 0, 0, 0, 0 }
\r
154 > @@ -287,6 +314,10 @@ main (int argc, char *argv[])
\r
158 > + if (stderr_file && redirect_stderr (stderr_file) != 0) {
\r
159 > + /* error already printed */
\r
163 > return notmuch_help_command (NULL, argc - 1, &argv[1]);
\r
168 > _______________________________________________
\r
169 > notmuch mailing list
\r
170 > notmuch@notmuchmail.org
\r
171 > http://notmuchmail.org/mailman/listinfo/notmuch
\r