mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
#6358: Merge r73933: Add basic tests for the return value of os.popen().close().
And fix the implementation to make these tests pass with py3k
This commit is contained in:
parent
15ccb3d3f7
commit
97e5f281a7
3 changed files with 17 additions and 1 deletions
|
@ -643,7 +643,13 @@ class _wrap_close:
|
|||
self._proc = proc
|
||||
def close(self):
|
||||
self._stream.close()
|
||||
return self._proc.wait() << 8 # Shift left to match old behavior
|
||||
returncode = self._proc.wait()
|
||||
if returncode == 0:
|
||||
return None
|
||||
if name == 'nt':
|
||||
return returncode
|
||||
else:
|
||||
return returncode << 8 # Shift left to match old behavior
|
||||
def __getattr__(self, name):
|
||||
return getattr(self._stream, name)
|
||||
def __iter__(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue