diff -r 28cb0bcaa22e Lib/webbrowser.py --- a/Lib/webbrowser.py Mon Jul 30 03:38:02 2012 -0700 +++ b/Lib/webbrowser.py Mon Jul 30 14:14:38 2012 +0300 @@ -232,17 +232,14 @@ 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