From: "W. Trevor King" <wking@tremily.us>
To: notmuch@notmuchmail.org
Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
David Bremner <david@tethera.net>,
"W. Trevor King" <wking@tremily.us>
Subject: [PATCH 1/4] nmbug: Respect 'expect' in _spawn(..., wait=True)
Date: Tue, 10 Oct 2017 15:49:49 -0700 [thread overview]
Message-ID: <6e0a94f4d1f70cf17d6e315d52a4801fc9fd114d.1507675236.git.wking@tremily.us> (raw)
In-Reply-To: <cover.1507675236.git.wking@tremily.us>
In-Reply-To: <cover.1507675236.git.wking@tremily.us>
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
next prev parent reply other threads:[~2017-10-10 22:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-10 22:49 [PATCH 0/3] nmbug: W. Trevor King
2017-10-10 22:49 ` W. Trevor King [this message]
2017-10-10 22:49 ` [PATCH 2/4] nmbug: Accept failures to unset core.worktree in clone W. Trevor King
2017-10-10 22:49 ` [PATCH 3/4] nmbug: Auto-checkout in clone if it wouldn't clobber W. Trevor King
2017-12-11 13:10 ` David Bremner
2017-12-11 17:47 ` W. Trevor King
2017-12-11 20:51 ` David Bremner
2017-10-10 23:15 ` [PATCH 0/3] nmbug: Daniel Kahn Gillmor
2017-10-14 12:51 ` Jani Nikula
2017-10-16 17:05 ` [PATCH 0/3] nmbug: clone core.worktree and auto-checkout (was: [PATCH 0/3] nmbug:) W. Trevor King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6e0a94f4d1f70cf17d6e315d52a4801fc9fd114d.1507675236.git.wking@tremily.us \
--to=wking@tremily.us \
--cc=david@tethera.net \
--cc=dkg@fifthhorseman.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).