Title: [224866] trunk/Tools
Revision
224866
Author
commit-qu...@webkit.org
Date
2017-11-14 19:46:12 -0800 (Tue, 14 Nov 2017)

Log Message

[Windows] Fix error while launching subprocess on Windows Python
https://bugs.webkit.org/show_bug.cgi?id=179637

Patch by Basuke Suzuki <basuke.suz...@sony.com> on 2017-11-14
Reviewed by Alex Christensen.

To pass environment variables to subprocess.popen on Windows Python 2,
the dict values must be str not unicode.
Also is_native_win() method is added to port.

* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo.is_native_win):
* Scripts/webkitpy/common/system/platforminfo_mock.py:
(MockPlatformInfo.is_native_win):
* Scripts/webkitpy/common/system/platforminfo_unittest.py:
(TestPlatformInfo.test_os_name_and_wrappers):
* Scripts/webkitpy/port/server_process.py:
(ServerProcess.__init__):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (224865 => 224866)


--- trunk/Tools/ChangeLog	2017-11-15 01:25:26 UTC (rev 224865)
+++ trunk/Tools/ChangeLog	2017-11-15 03:46:12 UTC (rev 224866)
@@ -1,3 +1,23 @@
+2017-11-14  Basuke Suzuki  <basuke.suz...@sony.com>
+
+        [Windows] Fix error while launching subprocess on Windows Python
+        https://bugs.webkit.org/show_bug.cgi?id=179637
+
+        Reviewed by Alex Christensen.
+
+        To pass environment variables to subprocess.popen on Windows Python 2,
+        the dict values must be str not unicode.
+        Also is_native_win() method is added to port.
+
+        * Scripts/webkitpy/common/system/platforminfo.py:
+        (PlatformInfo.is_native_win):
+        * Scripts/webkitpy/common/system/platforminfo_mock.py:
+        (MockPlatformInfo.is_native_win):
+        * Scripts/webkitpy/common/system/platforminfo_unittest.py:
+        (TestPlatformInfo.test_os_name_and_wrappers):
+        * Scripts/webkitpy/port/server_process.py:
+        (ServerProcess.__init__):
+
 2017-11-14  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h

Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py (224865 => 224866)


--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py	2017-11-15 01:25:26 UTC (rev 224865)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo.py	2017-11-15 03:46:12 UTC (rev 224866)
@@ -70,6 +70,9 @@
     def is_win(self):
         return self.os_name == 'win'
 
+    def is_native_win(self):
+        return self.is_win() and not self.is_cygwin()
+
     def is_cygwin(self):
         return self._is_cygwin
 

Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py (224865 => 224866)


--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py	2017-11-15 01:25:26 UTC (rev 224865)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo_mock.py	2017-11-15 03:46:12 UTC (rev 224866)
@@ -48,6 +48,9 @@
     def is_win(self):
         return self.os_name == 'win'
 
+    def is_native_win(self):
+        return self.is_win() and not self.is_cygwin()
+
     def is_cygwin(self):
         return self.os_name == 'cygwin'
 

Modified: trunk/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py (224865 => 224866)


--- trunk/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py	2017-11-15 01:25:26 UTC (rev 224865)
+++ trunk/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py	2017-11-15 03:46:12 UTC (rev 224866)
@@ -111,6 +111,7 @@
         self.assertFalse(info.is_linux())
         self.assertFalse(info.is_mac())
         self.assertTrue(info.is_win())
+        self.assertTrue(info.is_native_win())
         self.assertFalse(info.is_freebsd())
 
         info = self.make_info(fake_sys('cygwin'), executive=fake_executive('6.1.7600'))
@@ -118,6 +119,7 @@
         self.assertFalse(info.is_linux())
         self.assertFalse(info.is_mac())
         self.assertTrue(info.is_win())
+        self.assertFalse(info.is_native_win())
         self.assertFalse(info.is_freebsd())
 
         info = self.make_info(fake_sys('freebsd8'))

Modified: trunk/Tools/Scripts/webkitpy/port/server_process.py (224865 => 224866)


--- trunk/Tools/Scripts/webkitpy/port/server_process.py	2017-11-15 01:25:26 UTC (rev 224865)
+++ trunk/Tools/Scripts/webkitpy/port/server_process.py	2017-11-15 03:46:12 UTC (rev 224866)
@@ -64,7 +64,13 @@
         self._port = port_obj
         self._name = name  # Should be the command name (e.g. DumpRenderTree, ImageDiff)
         self._cmd = cmd
-        self._env = env
+
+        # Windows does not allow unicode values in the environment
+        if env and self._port.host.platform.is_native_win():
+            self._env = {key: env[key].encode('utf-8') for key in env}
+        else:
+            self._env = env
+
         # Set if the process outputs non-standard newlines like '\r\n' or '\r'.
         # Don't set if there will be binary data or the data must be ASCII encoded.
         self._universal_newlines = universal_newlines
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to