Revert Popen bufsize to Python 2.7 default value.

This might be the reason causing the process to not terminate.

This CL adds also more logging.

No-Presubmit: True
Bug: webrtc:13607
Change-Id: I9fc2cf39d2c1df92670b45dd081022ce69068836
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250181
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35885}
This commit is contained in:
Mirko Bonadei
2022-02-02 13:41:13 +01:00
committed by WebRTC LUCI CQ
parent 1901551b00
commit d5f98ce8cf

View File

@ -177,14 +177,19 @@ def _RunPesq(executable_path,
# Need to provide paths in the current directory due to a bug in PESQ:
# On Mac, for some 'path/to/file.wav', if 'file.wav' is longer than
# 'path/to', PESQ crashes.
# The bufsize is set to 0 to keep the default Python 2.7 behaviour (it
# changed to -1 in Python >3.3.1 but this is causing issues).
process = subprocess.Popen(_LogCommand(command),
bufsize=0,
cwd=directory,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
try:
logging.info('Waiting for termination ...')
out, err = process.communicate(timeout=120)
except TimeoutExpired:
logging.error('Timeout, killing the process.')
process.kill()
out, err = process.communicate()