Commit 8cd8a660 authored by Georg Brandl's avatar Georg Brandl

Fix webbrowser.BackgroundBrowser on Windows.

 (backport from rev. 51991)
parent 507d97d0
...@@ -165,6 +165,9 @@ class GenericBrowser(BaseBrowser): ...@@ -165,6 +165,9 @@ class GenericBrowser(BaseBrowser):
cmdline = [self.name] + [arg.replace("%s", url) cmdline = [self.name] + [arg.replace("%s", url)
for arg in self.args] for arg in self.args]
try: try:
if sys.platform[:3] == 'win':
p = subprocess.Popen(cmdline)
else:
p = subprocess.Popen(cmdline, close_fds=True) p = subprocess.Popen(cmdline, close_fds=True)
return not p.wait() return not p.wait()
except OSError: except OSError:
...@@ -178,10 +181,13 @@ class BackgroundBrowser(GenericBrowser): ...@@ -178,10 +181,13 @@ class BackgroundBrowser(GenericBrowser):
def open(self, url, new=0, autoraise=1): def open(self, url, new=0, autoraise=1):
cmdline = [self.name] + [arg.replace("%s", url) cmdline = [self.name] + [arg.replace("%s", url)
for arg in self.args] for arg in self.args]
try:
if sys.platform[:3] == 'win':
p = subprocess.Popen(cmdline)
else:
setsid = getattr(os, 'setsid', None) setsid = getattr(os, 'setsid', None)
if not setsid: if not setsid:
setsid = getattr(os, 'setpgrp', None) setsid = getattr(os, 'setpgrp', None)
try:
p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid) p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
return (p.poll() is None) return (p.poll() is None)
except OSError: except OSError:
......
...@@ -14,12 +14,21 @@ Core and builtins ...@@ -14,12 +14,21 @@ Core and builtins
- Allow exception instances to be directly sliced again. - Allow exception instances to be directly sliced again.
Extension Modules Extension Modules
----------------- -----------------
- Fix itertools.count(n) to work with negative numbers again. - Fix itertools.count(n) to work with negative numbers again.
Library
-------
- Make webbrowser.BackgroundBrowser usable in Windows (it wasn't because
the close_fds arg to subprocess.Popen is not supported).
What's New in Python 2.5 (final) What's New in Python 2.5 (final)
================================ ================================
...@@ -27,6 +36,7 @@ What's New in Python 2.5 (final) ...@@ -27,6 +36,7 @@ What's New in Python 2.5 (final)
No changes since release candidate 2. No changes since release candidate 2.
What's New in Python 2.5 release candidate 2? What's New in Python 2.5 release candidate 2?
============================================= =============================================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment