]> granicus.if.org Git - python/commitdiff
Fix for bug #1634343: allow specifying empty arguments on Windows
authorPeter Astrand <astrand@lysator.liu.se>
Sat, 13 Jan 2007 22:37:11 +0000 (22:37 +0000)
committerPeter Astrand <astrand@lysator.liu.se>
Sat, 13 Jan 2007 22:37:11 +0000 (22:37 +0000)
Lib/subprocess.py
Lib/test/test_subprocess.py

index abd790dd92a094fd0ab8c249b806244ca3089289..eb1a7356719e9fa2d1347bd2ac691c47fba7b8a0 100644 (file)
@@ -499,7 +499,7 @@ def list2cmdline(seq):
         if result:
             result.append(' ')
 
-        needquote = (" " in arg) or ("\t" in arg)
+        needquote = (" " in arg) or ("\t" in arg) or arg == ""
         if needquote:
             result.append('"')
 
index 64f8d40a40b34c58672f265df5ac4155ce0a70cc..c2db6fab20b7d4bb56b544ef83f147ff16820f1c 100644 (file)
@@ -430,6 +430,8 @@ class ProcessTestCase(unittest.TestCase):
                          '"a\\\\b c" d e')
         self.assertEqual(subprocess.list2cmdline(['a\\\\b\\ c', 'd', 'e']),
                          '"a\\\\b\\ c" d e')
+        self.assertEqual(subprocess.list2cmdline(['ab', '']),
+                         'ab ""')
 
 
     def test_poll(self):