Title: [88287] trunk/Tools
Revision
88287
Author
[email protected]
Date
2011-06-07 16:58:19 -0700 (Tue, 07 Jun 2011)

Log Message

2011-06-07  Dirk Pranke  <[email protected]>

        Reviewed by Eric Seidel.

        webkitpy: add a popen() call to executive
        https://bugs.webkit.org/show_bug.cgi?id=62179

        This change adds a popen() wrapper call to the Executive object.
        This will allow other webkitpy scripts that currently call
        subprocess directly to use Executive, instead.

        No additional tests are necessary (the existing tests cover the code).

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

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (88286 => 88287)


--- trunk/Tools/ChangeLog	2011-06-07 23:57:32 UTC (rev 88286)
+++ trunk/Tools/ChangeLog	2011-06-07 23:58:19 UTC (rev 88287)
@@ -1,3 +1,18 @@
+2011-06-07  Dirk Pranke  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        webkitpy: add a popen() call to executive
+        https://bugs.webkit.org/show_bug.cgi?id=62179
+
+        This change adds a popen() wrapper call to the Executive object.
+        This will allow other webkitpy scripts that currently call
+        subprocess directly to use Executive, instead.
+
+        No additional tests are necessary (the existing tests cover the code).
+
+        * Scripts/webkitpy/common/system/executive.py:
+
 2011-06-07  Sam Weinig  <[email protected]>
 
         Reviewed by Anders Carlsson.

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


--- trunk/Tools/Scripts/webkitpy/common/system/executive.py	2011-06-07 23:57:32 UTC (rev 88286)
+++ trunk/Tools/Scripts/webkitpy/common/system/executive.py	2011-06-07 23:58:19 UTC (rev 88287)
@@ -103,6 +103,8 @@
 
 
 class Executive(object):
+    PIPE = subprocess.PIPE
+    STDOUT = subprocess.STDOUT
 
     def _should_close_fds(self):
         # We need to pass close_fds=True to work around Python bug #2320
@@ -116,10 +118,10 @@
         args = map(unicode, args)  # Popen will throw an exception if args are non-strings (like int())
         args = map(self._encode_argument_if_needed, args)
 
-        child_process = subprocess.Popen(args,
-                                         stdout=subprocess.PIPE,
-                                         stderr=subprocess.STDOUT,
-                                         close_fds=self._should_close_fds())
+        child_process = self.popen(args,
+                                   stdout=self.PIPE,
+                                   stderr=self.STDOUT,
+                                   close_fds=self._should_close_fds())
 
         # Use our own custom wait loop because Popen ignores a tee'd
         # stderr/stdout.
@@ -340,7 +342,7 @@
         # FIXME: We may need to encode differently on different platforms.
         if isinstance(input, unicode):
             input = input.encode(self._child_process_encoding())
-        return (subprocess.PIPE, input)
+        return (self.PIPE, input)
 
     def _command_for_printing(self, args):
         """Returns a print-ready string representing command args.
@@ -370,14 +372,14 @@
         args = map(self._encode_argument_if_needed, args)
 
         stdin, string_to_communicate = self._compute_stdin(input)
-        stderr = subprocess.STDOUT if return_stderr else None
+        stderr = self.STDOUT if return_stderr else None
 
-        process = subprocess.Popen(args,
-                                   stdin=stdin,
-                                   stdout=subprocess.PIPE,
-                                   stderr=stderr,
-                                   cwd=cwd,
-                                   close_fds=self._should_close_fds())
+        process = self.popen(args,
+                             stdin=stdin,
+                             stdout=self.PIPE,
+                             stderr=stderr,
+                             cwd=cwd,
+                             close_fds=self._should_close_fds())
         output = process.communicate(string_to_communicate)[0]
 
         # run_command automatically decodes to unicode() unless explicitly told not to.
@@ -431,3 +433,6 @@
         if not self._should_encode_child_process_arguments():
             return argument
         return argument.encode(self._child_process_encoding())
+
+    def popen(self, *args, **kwargs):
+        return subprocess.Popen(*args, **kwargs)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to