]> granicus.if.org Git - python/commitdiff
Bug #1684254: webbrowser now uses shlex to split any command lines
authorGeorg Brandl <georg@python.org>
Wed, 21 Mar 2007 11:52:38 +0000 (11:52 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 21 Mar 2007 11:52:38 +0000 (11:52 +0000)
given to get(). It also detects when you use '&' as the last argument
and creates a BackgroundBrowser then.
 (backport -- this is a regression from 2.4 and therefore backported)

Lib/webbrowser.py
Misc/NEWS

index 37355877c8898e6e57be4cfdf06425935f654fc3..b71ef8d7d3d7714e83713c58aeb519b723de097d 100644 (file)
@@ -2,6 +2,7 @@
 """Interfaces for launching and remotely controlling Web browsers."""
 
 import os
+import shlex
 import sys
 import stat
 import subprocess
@@ -32,7 +33,11 @@ def get(using=None):
     for browser in alternatives:
         if '%s' in browser:
             # User gave us a command line, split it into name and args
-            return GenericBrowser(browser.split())
+            browser = shlex.split(browser)
+            if browser[-1] == '&':
+                return BackgroundBrowser(browser[:-1])
+            else:
+                return GenericBrowser(browser)
         else:
             # User gave us a browser name or path.
             try:
index d8c887100817d426c63619683e9ad8de6e32d237..bc29eaaf65a2559096b6370d23ade94dbdb66cec 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -217,6 +217,10 @@ Extension Modules
 Library
 -------
 
+- Bug #1684254: webbrowser now uses shlex to split any command lines
+  given to get(). It also detects when you use '&' as the last argument
+  and creates a BackgroundBrowser then.
+
 - Patch #1681153: the wave module now closes a file object it opened if
   initialization failed.