[issue1731717] race condition in subprocess module

jan matejek report at bugs.python.org
Tue Aug 16 20:21:52 CEST 2011


jan matejek <jmatejek at suse.cz> added the comment:

please check my logic here, but the patched code seems to throw away perfectly valid return codes:
in wait(), self._handle_exitstatus(sts) gets called unconditionally, and it resets self.returncode also unconditionally.
now, if a _cleanup() already did _internal_poll and set self.returncode that way, it is lost when wait() catches the ECHILD, in the one place where it actually matters, by setting sts=0 for the _handle_exitstatus call

IMHO it could be fixed by moving _handle_exitstatus to the try: section, and returning "self.returncode or 0" or something like that

----------
nosy: +matejcik

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1731717>
_______________________________________


More information about the Python-bugs-list mailing list