From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 263116DE1149 for ; Tue, 10 Oct 2017 15:56:16 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.212 X-Spam-Level: X-Spam-Status: No, score=-0.212 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.211, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h965eDjw75Ak for ; Tue, 10 Oct 2017 15:56:14 -0700 (PDT) Received: from resqmta-po-01v.sys.comcast.net (resqmta-po-01v.sys.comcast.net [96.114.154.160]) by arlo.cworth.org (Postfix) with ESMTPS id 7CA186DE0FD2 for ; Tue, 10 Oct 2017 15:56:14 -0700 (PDT) Received: from resomta-po-01v.sys.comcast.net ([96.114.154.225]) by resqmta-po-01v.sys.comcast.net with ESMTP id 23JXeFzjFons623Jkeqvs6; Tue, 10 Oct 2017 22:48:04 +0000 Received: from mail.tremily.us ([IPv6:2001:558:600a:ce:480b:3bd8:dc5a:403a]) by resomta-po-01v.sys.comcast.net with SMTP id 23Jhe4LfRzp9p23JiezYdI; Tue, 10 Oct 2017 22:48:02 +0000 Received: from ullr.tremily.us (ullr.tremily.us [192.168.10.7]) by mail.tremily.us (Postfix) with SMTP id E1548F57AEF; Tue, 10 Oct 2017 15:48:25 -0700 (PDT) Received: (nullmailer pid 4990 invoked by uid 1000); Tue, 10 Oct 2017 22:49:55 -0000 From: "W. Trevor King" To: notmuch@notmuchmail.org Cc: Daniel Kahn Gillmor , David Bremner , "W. Trevor King" Subject: [PATCH 1/4] nmbug: Respect 'expect' in _spawn(..., wait=True) Date: Tue, 10 Oct 2017 15:49:49 -0700 Message-Id: <6e0a94f4d1f70cf17d6e315d52a4801fc9fd114d.1507675236.git.wking@tremily.us> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: X-CMAE-Envelope: MS4wfLOE4OMwRdwQVMhLWOrbTKlmjJNZsMr1lNfvFrGOoxoFnLejCl67dw5iUtMjcK5AGaDINuglhx+3iZ3QpBdHEmB+Kkuvp7l6NF4X/zYAiY9/4QbmSqjT B9Cne4vVu3VHvHeho3T9Z2kGPP+yathvtT9iR7GNnL6JjBbitUeK8wtbGc7d4pPEps4m2IxOjzAeHinpYoNjCJSgR+2F4V+0gZk= X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Oct 2017 22:56:16 -0000 Fixing a bug from 7f2cb3be (nmbug: Translate to Python, 2014-10-03). The bug had no direct impact though, because none of the wait=True callers were setting expect. Also add expected codes to the debug messages, to help log readers understand why nonzero exits are occasionally accepted. --- devel/nmbug/nmbug | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug index 6febf16f..755bd7db 100755 --- a/devel/nmbug/nmbug +++ b/devel/nmbug/nmbug @@ -169,8 +169,9 @@ class _SubprocessContextManager(object): stream.close() setattr(self._process, name, None) status = self._process.wait() - _LOG.debug('collect {args} with status {status}'.format( - args=self._args, status=status)) + _LOG.debug( + 'collect {args} with status {status} (expected {expect})'.format( + args=self._args, status=status, expect=self._expect)) if status not in self._expect: raise SubprocessError(args=self._args, status=status) @@ -211,13 +212,14 @@ def _spawn(args, input=None, additional_env=None, wait=False, stdin=None, input = input.encode(encoding) (stdout, stderr) = p.communicate(input=input) status = p.wait() - _LOG.debug('collect {args} with status {status}'.format( - args=args, status=status)) + _LOG.debug( + 'collect {args} with status {status} (expected {expect})'.format( + args=args, status=status, expect=expect)) if stdout is not None: stdout = stdout.decode(encoding) if stderr is not None: stderr = stderr.decode(encoding) - if status: + if status not in expect: raise SubprocessError( args=args, status=status, stdout=stdout, stderr=stderr) return (status, stdout, stderr) -- 2.13.6