Changeset 68913 in webkit


Ignore:
Timestamp:
Oct 1, 2010 12:38:00 PM (14 years ago)
Author:
Adam Roben
Message:

Encode Executive command arguments using UTF-8 on Cygwin

Cygwin's Python's os.execv doesn't support unicode command arguments.
Cygwin's execv expects arguments to be encoded using the current code
page. But code pages are limited in what characters they can handle,
and our tests include characters that the English code page can't
handle. So for now we'll just encode everything in UTF-8 on Cygwin,
which can handle all characters but might confuse some commands, for
expediency's sake. I'm sure we'll run into cases where UTF-8 isn't
good enough, but we can deal with that when the problem arises.

Reviewed by Adam Barth.

Fixes <http://webkit.org/b/46892> <rdar://problem/8496639>
webkitpy.common.system.executive_unittest.ExecutiveTest.test_run_command_with_unicode
fails on Windows

  • Scripts/webkitpy/common/system/executive.py:

(Executive._run_command_with_teed_output):
(Executive.run_command):
On Cygwin, encode arguments using UTF-8.

Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r68910 r68913  
     12010-10-01  Adam Roben  <aroben@apple.com>
     2
     3        Encode Executive command arguments using UTF-8 on Cygwin
     4
     5        Cygwin's Python's os.execv doesn't support unicode command arguments.
     6        Cygwin's execv expects arguments to be encoded using the current code
     7        page. But code pages are limited in what characters they can handle,
     8        and our tests include characters that the English code page can't
     9        handle.  So for now we'll just encode everything in UTF-8 on Cygwin,
     10        which can handle all characters but might confuse some commands, for
     11        expediency's sake. I'm sure we'll run into cases where UTF-8 isn't
     12        good enough, but we can deal with that when the problem arises.
     13
     14        Reviewed by Adam Barth.
     15
     16        Fixes <http://webkit.org/b/46892> <rdar://problem/8496639>
     17        webkitpy.common.system.executive_unittest.ExecutiveTest.test_run_command_with_unicode
     18        fails on Windows
     19
     20        * Scripts/webkitpy/common/system/executive.py:
     21        (Executive._run_command_with_teed_output):
     22        (Executive.run_command):
     23        On Cygwin, encode arguments using UTF-8.
     24
    1252010-10-01  Sam Weinig  <sam@webkit.org>
    226
  • trunk/WebKitTools/Scripts/webkitpy/common/system/executive.py

    r65979 r68913  
    104104    def _run_command_with_teed_output(self, args, teed_output):
    105105        args = map(unicode, args)  # Popen will throw an exception if args are non-strings (like int())
     106        if sys.platform == 'cygwin':
     107            # Cygwin's Python's os.execv doesn't support unicode command
     108            # arguments, and neither does Cygwin's execv itself.
     109            # FIXME: Using UTF-8 here will confuse Windows-native commands
     110            # which will expect arguments to be encoded using the current code
     111            # page.
     112            args = [arg.encode('utf-8') for arg in args]
    106113        child_process = subprocess.Popen(args,
    107114                                         stdout=subprocess.PIPE,
     
    282289        start_time = time.time()
    283290        args = map(unicode, args)  # Popen will throw an exception if args are non-strings (like int())
     291        if sys.platform == 'cygwin':
     292            # Cygwin's Python's os.execv doesn't support unicode command
     293            # arguments, and neither does Cygwin's execv itself.
     294            # FIXME: Using UTF-8 here will confuse Windows-native commands
     295            # which will expect arguments to be encoded using the current code
     296            # page.
     297            args = [arg.encode('utf-8') for arg in args]
    284298        stdin, string_to_communicate = self._compute_stdin(input)
    285299        stderr = subprocess.STDOUT if return_stderr else None
Note: See TracChangeset for help on using the changeset viewer.