1 Return-Path: <bremner@tethera.net>
\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 127D8431FD0
\r
6 for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 09:25:59 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id mUosXxvQ2SQs for <notmuch@notmuchmail.org>;
\r
16 Sat, 11 Jan 2014 09:25:52 -0800 (PST)
\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])
\r
18 (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id D8EAC431FC3
\r
21 for <notmuch@notmuchmail.org>; Sat, 11 Jan 2014 09:25:52 -0800 (PST)
\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)
\r
23 (envelope-from <bremner@tethera.net>)
\r
24 id 1W22Jk-0004S2-HV; Sat, 11 Jan 2014 13:25:52 -0400
\r
25 Received: (nullmailer pid 16887 invoked by uid 1000); Sat, 11 Jan 2014
\r
27 From: David Bremner <david@tethera.net>
\r
28 To: notmuch@notmuchmail.org
\r
29 Subject: [PATCH] test/emacs: replace the use of process-attributes with
\r
31 Date: Sat, 11 Jan 2014 13:25:39 -0400
\r
32 Message-Id: <1389461139-20249-1-git-send-email-david@tethera.net>
\r
33 X-Mailer: git-send-email 1.8.5.2
\r
34 In-Reply-To: <m2bnziygdu.fsf@guru.guru-group.fi>
\r
35 References: <m2bnziygdu.fsf@guru.guru-group.fi>
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.13
\r
39 List-Id: "Use and development of the notmuch mail system."
\r
40 <notmuch.notmuchmail.org>
\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
44 List-Post: <mailto:notmuch@notmuchmail.org>
\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
48 X-List-Received-Date: Sat, 11 Jan 2014 17:25:59 -0000
\r
50 In some environments (at least Hurd), process-attributes is
\r
51 unimplimented and always returns nil. This ends up causing test
\r
52 failures (see e.g. id:87a9ffofsc.fsf@zancas.localnet).
\r
54 Historically and according to POSIX 1003.1-2001, a signal of 0 can be
\r
55 used to check the validity of a pid. This seems less heinous than
\r
56 parsing the output of ps(1).
\r
59 Thanks to Domo for the simpler solution. Now that I think about it,
\r
60 perhaps this makes sense as a debian only update, since it currently
\r
61 fails only on Debian/Hurd, which according to the GNU project is the
\r
62 only "working distribution
\r
64 test/test-lib.el | 15 +++++++++------
\r
65 1 file changed, 9 insertions(+), 6 deletions(-)
\r
67 diff --git a/test/test-lib.el b/test/test-lib.el
\r
68 index d26b49f..37fcb3d 100644
\r
69 --- a/test/test-lib.el
\r
70 +++ b/test/test-lib.el
\r
71 @@ -77,19 +77,22 @@ invisible text."
\r
72 (setq start next-pos)))
\r
75 +;; process-attributes is not defined everywhere, so define an
\r
76 +;; alternate way to test if a process still exists.
\r
78 +(defun test-process-running (pid)
\r
80 + (signal-process pid 0)))
\r
82 (defun orphan-watchdog-check (pid)
\r
83 "Periodically check that the process with id PID is still
\r
84 running, quit if it terminated."
\r
85 - (if (not (process-attributes pid))
\r
86 + (if (not (test-process-running pid))
\r
89 (defun orphan-watchdog (pid)
\r
90 "Initiate orphan watchdog check."
\r
91 - ; If process-attributes returns nil right away, that probably means
\r
92 - ; it is unimplimented. So we delay two minutes before killing emacs.
\r
93 - (if (process-attributes pid)
\r
94 - (run-at-time 60 60 'orphan-watchdog-check pid)
\r
95 - (run-at-time 120 60 'orphan-watchdog-check pid)))
\r
96 + (run-at-time 60 60 'orphan-watchdog-check pid))
\r
98 (defun hook-counter (hook)
\r
99 "Count how many times a hook is called. Increments
\r