[Python-checkins] r51991 - in python/trunk: Lib/webbrowser.py Misc/NEWS

georg.brandl python-checkins at python.org
Sun Sep 24 12:36:04 CEST 2006


Author: georg.brandl
Date: Sun Sep 24 12:36:01 2006
New Revision: 51991

Modified:
   python/trunk/Lib/webbrowser.py
   python/trunk/Misc/NEWS
Log:
Fix webbrowser.BackgroundBrowser on Windows.


Modified: python/trunk/Lib/webbrowser.py
==============================================================================
--- python/trunk/Lib/webbrowser.py	(original)
+++ python/trunk/Lib/webbrowser.py	Sun Sep 24 12:36:01 2006
@@ -165,7 +165,10 @@
         cmdline = [self.name] + [arg.replace("%s", url)
                                  for arg in self.args]
         try:
-            p = subprocess.Popen(cmdline, close_fds=True)
+            if sys.platform[:3] == 'win':
+                p = subprocess.Popen(cmdline)
+            else:
+                p = subprocess.Popen(cmdline, close_fds=True)
             return not p.wait()
         except OSError:
             return False
@@ -178,11 +181,14 @@
     def open(self, url, new=0, autoraise=1):
         cmdline = [self.name] + [arg.replace("%s", url)
                                  for arg in self.args]
-        setsid = getattr(os, 'setsid', None)
-        if not setsid:
-            setsid = getattr(os, 'setpgrp', None)
         try:
-            p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
+            if sys.platform[:3] == 'win':
+                p = subprocess.Popen(cmdline)
+            else:
+                setsid = getattr(os, 'setsid', None)
+                if not setsid:
+                    setsid = getattr(os, 'setpgrp', None)
+                p = subprocess.Popen(cmdline, close_fds=True, preexec_fn=setsid)
             return (p.poll() is None)
         except OSError:
             return False

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Sep 24 12:36:01 2006
@@ -52,6 +52,9 @@
 Library
 -------
 
+- Make webbrowser.BackgroundBrowser usable in Windows (it wasn't because
+  the close_fds arg to subprocess.Popen is not supported).
+
 - Reverted patch #1504333 to sgmllib because it introduced an infinite loop.
 
 - Patch #1553314: Fix the inspect.py slowdown that was hurting IPython & SAGE


More information about the Python-checkins mailing list