소스 검색

Fix race condition in subprocess runner

stdin, stdout, and stderr being closed does not necessarily imply that the process has exited, although it usually does. Still need to explicitly wait for it to terminate after the I/O loop. This matches what the stdlib `subprocess.Popen._communicate` does as well.
tags/v1.0
JustAnotherArchivist 1 년 전
부모
커밋
adafd6bd01
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. +1
    -0
      codearchiver/subprocess.py

+ 1
- 0
codearchiver/subprocess.py 파일 보기

@@ -66,6 +66,7 @@ def run_with_log(args, *, check = True, input = None, **kwargs):
stdout.append(data)
if stderrBuf:
_logger.info(stderrBuf.decode('utf-8'))
p.wait()
assert p.poll() is not None
if input is not None and stdinOffset < len(input):
_logger.warning(f'Could not write all input to the stdin pipe (wanted to write {len(input)} bytes, only wrote {stdinOffset})')


불러오는 중...
취소
저장