[diffoscope] 04/10: diff: replaces Popen by subprocess.run
Juliana Oliveira
jwnx-guest at moszumanska.debian.org
Mon Jan 29 03:43:23 CET 2018
This is an automated email from the git hooks/post-receive script.
jwnx-guest pushed a commit to branch jwnx_subprocess_merge
in repository diffoscope.
commit 7bc18636e6024d7df5c1250ad289acb070d35b90
Author: Juliana Oliveira <juliana.orod at gmail.com>
Date: Fri Jan 19 04:39:58 2018 -0200
diff: replaces Popen by subprocess.run
Popen requires thread/IO micromanaging, and locks some interactions
with multiprocess lib due to its combined behavior with subprocess.PIPE, being
unusable with .map function. Subprocess.run simplifies command execution
by managing threads/IO and is also recommended over Popen since Python
3.5.
Signed-off-by: Juliana Oliveira <juliana.orod at gmail.com>
---
diffoscope/diff.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/diffoscope/diff.py b/diffoscope/diff.py
index f6d1552..f21aa45 100644
--- a/diffoscope/diff.py
+++ b/diffoscope/diff.py
@@ -72,7 +72,6 @@ class DiffParser(object):
self._action('')
self._success = True
- self._output.close()
def read_headers(self, line):
if not line:
@@ -165,15 +164,15 @@ def run_diff(fifo1, fifo2, end_nl_q1, end_nl_q2):
logger.debug("Running %s", ' '.join(cmd))
- p = subprocess.Popen(
+ p = subprocess.run(
cmd,
bufsize=1,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
+
parser = DiffParser(p.stdout, end_nl_q1, end_nl_q2)
parser.parse()
- p.wait()
logger.debug(
"%s: returncode %d, parsed %s",
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list