Patchwork [1,of,2] hghave: avoid a deadlock reading the child process's output

login
register
mail settings
Submitter Matt Harbison
Date June 1, 2018, 2:35 a.m.
Message ID <0de423ecd560edaa0f1e.1527820500@Envy>
Download mbox | patch
Permalink /patch/31922/
State Accepted
Headers show

Comments

Matt Harbison - June 1, 2018, 2:35 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1527819107 14400
#      Thu May 31 22:11:47 2018 -0400
# Node ID 0de423ecd560edaa0f1eb25cc265c3b2e8caf0f0
# Parent  7fa3408f83ef1a04e2d23ab6f8498833b450e589
hghave: avoid a deadlock reading the child process's output

The output of `pylint` is voluminous enough that it fills the buffer on Windows,
and waited for the parent to read it out.  But the parent was waiting on the
child to exit.

I'm not sure what the intent of setting `ret = -1` in the exception handler just
above this was...
Yuya Nishihara - June 1, 2018, 2:39 p.m.
On Thu, 31 May 2018 22:35:00 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1527819107 14400
> #      Thu May 31 22:11:47 2018 -0400
> # Node ID 0de423ecd560edaa0f1eb25cc265c3b2e8caf0f0
> # Parent  7fa3408f83ef1a04e2d23ab6f8498833b450e589
> hghave: avoid a deadlock reading the child process's output

Queued for stable, thanks.

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -98,8 +98,8 @@  def matchoutput(cmd, regexp, ignorestatu
         if e.errno != errno.ENOENT:
             raise
         ret = -1
-    ret = p.wait()
-    s = p.stdout.read()
+    s = p.communicate()[0]
+    ret = p.returncode
     return (ignorestatus or not ret) and r.search(s)
 
 @check("baz", "GNU Arch baz client")