Commits

Brodie Rao  committed 4d6c760

runner: use Popen.communicate() to send input to patch(1)

This works around EPIPE being raised when closing stdin under PyPy.

  • Participants
  • Parent commits 8f15bea

Comments (0)

Files changed (1)

     p = subprocess.Popen([cmd, '-p0'], bufsize=-1, stdin=subprocess.PIPE,
                          universal_newlines=True, preexec_fn=resetsigpipe,
                          close_fds=os.name == 'posix')
-    for line in diff:
-        p.stdin.write(line)
-    p.stdin.close()
-    p.wait()
+    p.communicate(''.join(diff))
     return p.returncode == 0
 
 def run(paths, tmpdir, quiet=False, verbose=False, patchcmd=None, answer=None,