gh-103300: Fix Popen.wait() deadlock in patchcheck.py (#103301)

This commit is contained in:
Oleg Iarygin 2023-04-09 12:18:53 +04:00 committed by GitHub
parent d9305f8e9d
commit 86d2044155
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -130,9 +130,10 @@ def changed_files(base_branch=None):
with subprocess.Popen(cmd.split(),
stdout=subprocess.PIPE,
cwd=SRCDIR) as st:
if st.wait() != 0:
git_file_status, _ = st.communicate()
if st.returncode != 0:
sys.exit(f'error running {cmd}')
for line in st.stdout:
for line in git_file_status.splitlines():
line = line.decode().rstrip()
status_text, filename = line.split(maxsplit=1)
status = set(status_text)