[Webkit-unassigned] [Bug 229824] New: [webkitpy] WrappedPopen breaks process returncode
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Sep 2 12:42:43 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=229824
Bug ID: 229824
Summary: [webkitpy] WrappedPopen breaks process returncode
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Tools / Tests
Assignee: webkit-unassigned at lists.webkit.org
Reporter: clopez at igalia.com
CC: jbedard at apple.com
The class WrappedPopen() was added in r250375 to wrap the subprocess.Popen() for making the python2 subprocess.Popen() objects more similar to the ones from python3.
But the way this class wraps the objects makes breaks the process returncode if the process doesn't return immediately.
This is because WrappedPopen() defines a new class the sets functions with the same name than subprocess.Popen() setting the value returned to the one that returns subprocess.Popen().
But in the case of subprocess.Popen().returncode that is not a function, but a string that will change of value when the process ends. If we evaluate this function before we call subprocess.Popen().communicate() or subprocess.Popen().wait() then the value of returncode will be None
This can be checked with this following test program: http://sprunge.us/aoxZ0j
If you run it with python2 you get "The call return code is None" instead of getting "The call return code is 2" which is what it should be (what happens when you run it with python3 which don't triggers the call to use WrappedPopen())
I have observed this when working on bug 229758 .. with python2 the call from host.executive.popen() always returned a returncode of None
This is not an issue for subprocess.Popen().stdout and subprocess.Popen().stderr because if you look at what prints the debug function on that example for this cases it sets the value to a descriptor rather than reading from the descriptor. So when the call to read from the descriptor is done it will work. Example, you see this:
setting attribute .. stdout to <open file '<fdopen>', mode 'rb' at 0x7fe12cc1d540>
setting attribute .. returncode to None
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210902/ea5ec0b0/attachment.htm>
More information about the webkit-unassigned
mailing list