Re: [PATCH v4 03/16] make shared crypto code behave library-like
[notmuch-archives.git] / 3f / 7719ece55e1d5acde63e15016a39677dd478b1
1 Return-Path: <wking@tremily.us>\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 0D981431FD5\r
6         for <notmuch@notmuchmail.org>; Sun,  6 Jul 2014 13:41:09 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: 0\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
13         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
14         autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id xCaDQjXAm5Uj for <notmuch@notmuchmail.org>;\r
18         Sun,  6 Jul 2014 13:41:03 -0700 (PDT)\r
19 Received: from qmta02.westchester.pa.mail.comcast.net\r
20         (qmta02.westchester.pa.mail.comcast.net [76.96.62.24])\r
21         by olra.theworths.org (Postfix) with ESMTP id 68AA3431FAF\r
22         for <notmuch@notmuchmail.org>; Sun,  6 Jul 2014 13:41:03 -0700 (PDT)\r
23 Received: from omta11.westchester.pa.mail.comcast.net ([76.96.62.36])\r
24         by qmta02.westchester.pa.mail.comcast.net with comcast\r
25         id P8Wk1o0020mv7h0518h2fB; Sun, 06 Jul 2014 20:41:02 +0000\r
26 Received: from odin.tremily.us ([24.18.63.50])\r
27         by omta11.westchester.pa.mail.comcast.net with comcast\r
28         id P8h01o00Y152l3L3X8h1kw; Sun, 06 Jul 2014 20:41:02 +0000\r
29 Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
30         by odin.tremily.us (Postfix) with ESMTPS id DBDB212700E5;\r
31         Sun,  6 Jul 2014 13:40:59 -0700 (PDT)\r
32 Received: (nullmailer pid 1903 invoked by uid 1000);\r
33         Sun, 06 Jul 2014 20:40:27 -0000\r
34 From: "W. Trevor King" <wking@tremily.us>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH 1/4] nmbug: Add a git_with_status helper function\r
37 Date: Sun,  6 Jul 2014 13:40:19 -0700\r
38 Message-Id:\r
39  <6ed6edd459cd50402d7e4abc50a6967709e08f16.1404678709.git.wking@tremily.us>\r
40 X-Mailer: git-send-email 1.9.1.353.gc66d89d\r
41 In-Reply-To: <cover.1404678709.git.wking@tremily.us>\r
42 References: <cover.1404678709.git.wking@tremily.us>\r
43 In-Reply-To: <cover.1404678709.git.wking@tremily.us>\r
44 References: <cover.1404678709.git.wking@tremily.us>\r
45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
46         s=q20140121; t=1404679262;\r
47         bh=F8943E/wKjGwJI6o5yUo8yKieldJZmtDMJYcSp0mvB0=;\r
48         h=Received:Received:Received:Received:From:To:Subject:Date:\r
49         Message-Id;\r
50         b=ffL4y7Es10phNqbHXfZElBlRZpYeNx3stg7ER4TEko5NMVR20W8i/Z/R6T1sj63gS\r
51         EI3RU5/RksOZxtBZktUmoEZ9W0lS02nj/0z1C0bMT2xdCeJMl/E/ntvCpT1beDg21u\r
52         3a3y0F7CBFsO1AblQ8LNUpVj8kA2/DqUzOkQv1reDzLNtE9tVgxNufUhc5GrS+ecKb\r
53         SHlBrlkUcIcoJ4VSCx+f9G7Ueq/6aOoP+ZXklYOzLi0BzJmyhK1fzha2kIBf2OXOX6\r
54         pca5EC9vxi8N2v17WWUqgTs/JDLbpHxW02LXSkIYcN/8j3lWrkrc3R8vxRGMR/Rxb3\r
55         5nLy16PaIBr8w==\r
56 Cc: Tomi Ollila <tomi.ollila@iki.fi>, David Bremner <bremner@debian.org>\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\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: Sun, 06 Jul 2014 20:41:09 -0000\r
70 \r
71 Sometimes we want to catch Git errors and handle them, instead of\r
72 dying with an error message.  This lower-level version of git() allows\r
73 us to get the error status when we want it.\r
74 ---\r
75  devel/nmbug/nmbug | 13 ++++++++++---\r
76  1 file changed, 10 insertions(+), 3 deletions(-)\r
77 \r
78 diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug\r
79 index b18ded7..4a79722 100755\r
80 --- a/devel/nmbug/nmbug\r
81 +++ b/devel/nmbug/nmbug\r
82 @@ -63,13 +63,20 @@ sub git_pipe {\r
83    spawn ($envref, defined $ioref ? $ioref : (), defined $dir ? $dir : (), @_);\r
84  }\r
85  \r
86 -sub git {\r
87 +sub git_with_status {\r
88    my $fh = git_pipe (@_);\r
89    my $str = join ('', <$fh>);\r
90 -  unless (close $fh) {\r
91 +  close $fh;\r
92 +  my $status = $?;\r
93 +  chomp($str);\r
94 +  return ($str, $status);\r
95 +}\r
96 +\r
97 +sub git {\r
98 +  my ($str, $status) = git_with_status (@_);\r
99 +  if ($status) {\r
100      die "'git @_' exited with nonzero value\n";\r
101    }\r
102 -  chomp($str);\r
103    return $str;\r
104  }\r
105  \r
106 -- \r
107 1.9.1.353.gc66d89d\r
108 \r