Title: [137927] trunk/Tools
Revision
137927
Author
[email protected]
Date
2012-12-17 11:35:24 -0800 (Mon, 17 Dec 2012)

Log Message

rpt --profile --chromium-android throws exception
https://bugs.webkit.org/show_bug.cgi?id=105061

Reviewed by Daniel Bates.

Somehow popen(args) got turned into popen(*args) at some point,
which caused my new stringify code to fail when args was passed by name.
Fixed and tested.

* Scripts/webkitpy/common/system/executive.py:
(Executive._stringify_args):
(Executive):
(Executive.popen):
* Scripts/webkitpy/common/system/executive_unittest.py:
(ExecutiveTest.test_popen_args):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (137926 => 137927)


--- trunk/Tools/ChangeLog	2012-12-17 19:32:26 UTC (rev 137926)
+++ trunk/Tools/ChangeLog	2012-12-17 19:35:24 UTC (rev 137927)
@@ -1,3 +1,21 @@
+2012-12-17  Eric Seidel  <[email protected]>
+
+        rpt --profile --chromium-android throws exception
+        https://bugs.webkit.org/show_bug.cgi?id=105061
+
+        Reviewed by Daniel Bates.
+
+        Somehow popen(args) got turned into popen(*args) at some point,
+        which caused my new stringify code to fail when args was passed by name.
+        Fixed and tested.
+
+        * Scripts/webkitpy/common/system/executive.py:
+        (Executive._stringify_args):
+        (Executive):
+        (Executive.popen):
+        * Scripts/webkitpy/common/system/executive_unittest.py:
+        (ExecutiveTest.test_popen_args):
+
 2012-12-17  Mark Pilgrim  <[email protected]>
 
         Use Platform::current() instead of webKitPlatformSupport() in DumpRenderTree

Modified: trunk/Tools/Scripts/webkitpy/common/system/executive.py (137926 => 137927)


--- trunk/Tools/Scripts/webkitpy/common/system/executive.py	2012-12-17 19:32:26 UTC (rev 137926)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive.py	2012-12-17 19:35:24 UTC (rev 137927)
@@ -471,13 +471,14 @@
             return argument
         return argument.encode(self._child_process_encoding())
 
-    def _stringify_args(self, *args):
+    def _stringify_args(self, args):
         # Popen will throw an exception if args are non-strings (like int())
-        string_args = map(unicode, *args)
+        string_args = map(unicode, args)
         # The Windows implementation of Popen cannot handle unicode strings. :(
         return map(self._encode_argument_if_needed, string_args)
 
-    def popen(self, *args, **kwargs):
+    # The only required arugment to popen is named "args", the rest are optional keyword arguments.
+    def popen(self, args, **kwargs):
         # FIXME: We should always be stringifying the args, but callers who pass shell=True
         # expect that the exact bytes passed will get passed to the shell (even if they're wrongly encoded).
         # shell=True is wrong for many other reasons, and we should remove this
@@ -485,7 +486,7 @@
         if kwargs.get('shell') == True:
             string_args = args
         else:
-            string_args = self._stringify_args(*args)
+            string_args = self._stringify_args(args)
         return subprocess.Popen(string_args, **kwargs)
 
     def run_in_parallel(self, command_lines_and_cwds, processes=None):

Modified: trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py (137926 => 137927)


--- trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py	2012-12-17 19:32:26 UTC (rev 137926)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive_unittest.py	2012-12-17 19:35:24 UTC (rev 137927)
@@ -118,6 +118,11 @@
         executive.run_command(command_line('echo', 1))
         executive.popen(command_line('echo', 1)).wait()
 
+    def test_popen_args(self):
+        executive = Executive()
+        # Explicitly naming the 'args' argument should not thow an exception.
+        executive.popen(args=command_line('echo', 1)).wait()
+
     def test_run_command_with_unicode(self):
         """Validate that it is safe to pass unicode() objects
         to Executive.run* methods, and they will return unicode()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to