Revert r80216 "Reapply r79779: "Removed gclient_utils.Popen() and use subprocess2's ...""

Horked windows slaves this time.

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/6689023

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@80220 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
maruel@chromium.org
2011-04-01 21:00:11 +00:00
parent 93ef410768
commit 58ef297bc5
3 changed files with 38 additions and 23 deletions

View File

@@ -8,7 +8,6 @@ In theory you shouldn't need anything else in subprocess, or this module failed.
"""
from __future__ import with_statement
import errno
import logging
import os
import subprocess
@@ -125,7 +124,7 @@ def get_english_env(env):
def Popen(args, **kwargs):
"""Wraps subprocess.Popen() with various workarounds.
"""Wraps subprocess.Popen().
Returns a subprocess.Popen object.
@@ -135,8 +134,7 @@ def Popen(args, **kwargs):
shell parameter to a value.
- Adds support for VOID to not buffer when not needed.
Note: Popen() can throw OSError when cwd or args[0] doesn't exist. Translate
exceptions generated by cygwin when it fails trying to emulate fork().
Note: Popen() can throw OSError when cwd or args[0] doesn't exist.
"""
# Make sure we hack subprocess if necessary.
hack_subprocess()
@@ -162,20 +160,7 @@ def Popen(args, **kwargs):
kwargs['stdout'] = open(os.devnull, 'w')
if kwargs.get('stderr') in (VOID, os.devnull):
kwargs['stderr'] = open(os.devnull, 'w')
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
return subprocess.Popen(args, **kwargs)
def call(args, timeout=None, **kwargs):