diff options
| -rw-r--r-- | eventlet/green/subprocess.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/eventlet/green/subprocess.py b/eventlet/green/subprocess.py index 9f14596..597dfdf 100644 --- a/eventlet/green/subprocess.py +++ b/eventlet/green/subprocess.py @@ -115,7 +115,17 @@ class Popen(subprocess_orig.Popen): except AttributeError: pass + # Borrow subprocess.call() and check_call(), but patch them so they reference # OUR Popen class rather than subprocess.Popen. -call = FunctionType(six.get_function_code(subprocess_orig.call), globals()) -check_call = FunctionType(six.get_function_code(subprocess_orig.check_call), globals()) +def patched_function(function): + return FunctionType(six.get_function_code(function), globals()) + + +call = patched_function(subprocess_orig.call) +check_call = patched_function(subprocess_orig.check_call) +# check_output is Python 2.7+ +if hasattr(subprocess_orig, 'check_output'): + __patched__.append('check_output') + check_output = patched_function(subprocess_orig.check_output) +del patched_function |
