Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(971)

Unified Diff: subprocess2.py

Issue 6770028: Removed gclient_utils.Popen() and use subprocess2's version instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: updated test Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_utils.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: subprocess2.py
diff --git a/subprocess2.py b/subprocess2.py
index d59035b4878f008e8c7b1596cc4aefdebb67f947..9aefeea45702ca2ab177593539acf4ab1c240991 100644
--- a/subprocess2.py
+++ b/subprocess2.py
@@ -7,6 +7,7 @@
In theory you shouldn't need anything else in subprocess, or this module failed.
"""
+import errno
import logging
import os
import subprocess
@@ -79,7 +80,7 @@ def get_english_env(env):
def Popen(args, **kwargs):
- """Wraps subprocess.Popen().
+ """Wraps subprocess.Popen() with various workarounds.
Forces English output since it's easier to parse the stdout if it is always in
English.
@@ -87,7 +88,8 @@ def Popen(args, **kwargs):
Sets shell=True on windows by default. You can override this by forcing shell
parameter to a value.
- Popen() can throw OSError when cwd or args[0] doesn't exist.
+ Popen() can throw OSError when cwd or args[0] doesn't exist. Translate
+ exceptions generated by cygwin when it fails trying to emulate fork().
"""
# Make sure we hack subprocess if necessary.
hack_subprocess()
@@ -106,7 +108,20 @@ def Popen(args, **kwargs):
if kwargs.get('cwd', None):
tmp_str += '; cwd=%s' % kwargs['cwd']
logging.debug(tmp_str)
- return subprocess.Popen(args, **kwargs)
+ try:
+ return subprocess.Popen(args, **kwargs)
+ except OSError, e:
+ if e.errno == errno.EAGAIN and sys.platform == 'cygwin':
+ # Convert fork() emulation failure into a CalledProcessError().
+ raise CalledProcessError(
+ e.errno,
+ args,
+ kwargs.get('cwd'),
+ 'Visit '
+ 'http://code.google.com/p/chromium/wiki/CygwinDllRemappingFailure to '
+ 'learn how to fix this error; you need to rebase your cygwin dlls',
+ None)
+ raise
def call(args, timeout=None, **kwargs):
« no previous file with comments | « gclient_utils.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698