Title: [224795] trunk/Tools
Revision
224795
Author
[email protected]
Date
2017-11-13 16:55:41 -0800 (Mon, 13 Nov 2017)

Log Message

[Windows] Fix Python error for subprocess.popen with close_fds
https://bugs.webkit.org/show_bug.cgi?id=179553

Patch by Basuke Suzuki <[email protected]> on 2017-11-13
Reviewed by Per Arne Vollan.

* Scripts/webkitpy/port/server_process.py:
(ServerProcess._start):
(ServerProcess._should_close_fds):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (224794 => 224795)


--- trunk/Tools/ChangeLog	2017-11-14 00:49:06 UTC (rev 224794)
+++ trunk/Tools/ChangeLog	2017-11-14 00:55:41 UTC (rev 224795)
@@ -1,3 +1,14 @@
+2017-11-13  Basuke Suzuki  <[email protected]>
+
+        [Windows] Fix Python error for subprocess.popen with close_fds
+        https://bugs.webkit.org/show_bug.cgi?id=179553
+
+        Reviewed by Per Arne Vollan.
+
+        * Scripts/webkitpy/port/server_process.py:
+        (ServerProcess._start):
+        (ServerProcess._should_close_fds):
+
 2017-11-13  Michael Catanzaro  <[email protected]>
 
         [GTK] Require woff2 1.0.2 and drop direct brotli dependency

Modified: trunk/Tools/Scripts/webkitpy/port/server_process.py (224794 => 224795)


--- trunk/Tools/Scripts/webkitpy/port/server_process.py	2017-11-14 00:49:06 UTC (rev 224794)
+++ trunk/Tools/Scripts/webkitpy/port/server_process.py	2017-11-14 00:55:41 UTC (rev 224795)
@@ -110,13 +110,10 @@
         if self._proc:
             raise ValueError("%s already running" % self._name)
         self._reset()
-        # close_fds is a workaround for http://bugs.python.org/issue2320
-        # In Python 2.7.10, close_fds is also supported on Windows.
-        close_fds = True
         self._proc = self._target_host.executive.popen(self._cmd, stdin=self._target_host.executive.PIPE,
             stdout=self._target_host.executive.PIPE,
             stderr=self._target_host.executive.PIPE,
-            close_fds=close_fds,
+            close_fds=self._should_close_fds(),
             env=self._env,
             universal_newlines=self._universal_newlines)
         self._pid = self._proc.pid
@@ -124,6 +121,19 @@
             self._set_file_nonblocking(self._proc.stdout)
             self._set_file_nonblocking(self._proc.stderr)
 
+    def _should_close_fds(self):
+        # We need to pass close_fds=True to work around Python bug #2320
+        # (otherwise we can hang when we kill DumpRenderTree when we are running
+        # multiple threads). See http://bugs.python.org/issue2320 .
+        # In Python 2.7.10, close_fds is also supported on Windows.
+        # However, "you cannot set close_fds to true and also redirect the standard
+        # handles by setting stdin, stdout or stderr.".
+        platform = self._port.host.platform
+        if platform.is_win() and not platform.is_cygwin():
+            return False
+        else:
+            return True
+
     def _handle_possible_interrupt(self):
         """This routine checks to see if the process crashed or exited
         because of a keyboard interrupt and raises KeyboardInterrupt
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to