summaryrefslogtreecommitdiff
path: root/Lib/webbrowser.py
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2012-08-01 03:57:52 +0200
committerJesus Cea <jcea@jcea.es>2012-08-01 03:57:52 +0200
commitc9aa321a016343187e76fdae13d3a4c75e75afde (patch)
tree35631c53681ea5c5a923f40f97a18ee9360ca788 /Lib/webbrowser.py
parent0efcf99c9eebfd65f6dd7ecc5c94b1c340ad6513 (diff)
downloadcpython-git-c9aa321a016343187e76fdae13d3a4c75e75afde.tar.gz
Closes #15499: Sleep is hardcoded in webbrowser.UnixBrowser
Diffstat (limited to 'Lib/webbrowser.py')
-rw-r--r--Lib/webbrowser.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 5b441e6ecc..ce5b48e00d 100644
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -232,17 +232,14 @@ class UnixBrowser(BaseBrowser):
stdout=(self.redirect_stdout and inout or None),
stderr=inout, start_new_session=True)
if remote:
- # wait five seconds. If the subprocess is not finished, the
+ # wait at most five seconds. If the subprocess is not finished, the
# remote invocation has (hopefully) started a new instance.
- time.sleep(1)
- rc = p.poll()
- if rc is None:
- time.sleep(4)
- rc = p.poll()
- if rc is None:
- return True
- # if remote call failed, open() will try direct invocation
- return not rc
+ try:
+ rc = p.wait(5)
+ # if remote call failed, open() will try direct invocation
+ return not rc
+ except subprocess.TimeoutExpired:
+ return True
elif self.background:
if p.poll() is None:
return True