mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
gh-133089: Use original timeout value for TimeoutExpired
when the func subprocess.run
is called with a timeout (GH-133103)
Signed-off-by: Manjusaka <me@manjusaka.me> Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
51d2459e4d
commit
2bbcaedb75
4 changed files with 46 additions and 4 deletions
|
@ -1235,8 +1235,11 @@ class Popen:
|
|||
|
||||
finally:
|
||||
self._communication_started = True
|
||||
|
||||
sts = self.wait(timeout=self._remaining_time(endtime))
|
||||
try:
|
||||
sts = self.wait(timeout=self._remaining_time(endtime))
|
||||
except TimeoutExpired as exc:
|
||||
exc.timeout = timeout
|
||||
raise
|
||||
|
||||
return (stdout, stderr)
|
||||
|
||||
|
@ -2145,8 +2148,11 @@ class Popen:
|
|||
selector.unregister(key.fileobj)
|
||||
key.fileobj.close()
|
||||
self._fileobj2output[key.fileobj].append(data)
|
||||
|
||||
self.wait(timeout=self._remaining_time(endtime))
|
||||
try:
|
||||
self.wait(timeout=self._remaining_time(endtime))
|
||||
except TimeoutExpired as exc:
|
||||
exc.timeout = orig_timeout
|
||||
raise
|
||||
|
||||
# All data exchanged. Translate lists into strings.
|
||||
if stdout is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue