| Index: subprocess2.py
|
| diff --git a/subprocess2.py b/subprocess2.py
|
| index c9057ac6ae19dd32c996b6c333bd5cc071a21d84..d4fa5781d6ee1be9f99b14ab17c156f2b02f1260 100644
|
| --- a/subprocess2.py
|
| +++ b/subprocess2.py
|
| @@ -8,6 +8,7 @@ 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
|
| @@ -124,7 +125,7 @@ def get_english_env(env):
|
|
|
|
|
| def Popen(args, **kwargs):
|
| - """Wraps subprocess.Popen().
|
| + """Wraps subprocess.Popen() with various workarounds.
|
|
|
| Returns a subprocess.Popen object.
|
|
|
| @@ -134,7 +135,8 @@ 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.
|
| + 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().
|
| """
|
| # Make sure we hack subprocess if necessary.
|
| hack_subprocess()
|
| @@ -160,7 +162,20 @@ def Popen(args, **kwargs):
|
| kwargs['stdout'] = open(os.devnull, 'w')
|
| if kwargs.get('stderr') in (VOID, os.devnull):
|
| kwargs['stderr'] = open(os.devnull, 'w')
|
| - 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):
|
|
|