Don't attempt to wrap GreenPipes in GreenPipe

If the os module is monkeypatched, Python's standard subprocess module
will return greenio.GreenPipe instances for Popen objects' stdin, stdout,
and stderr attributes. However, eventlet.green.subprocess tries to wrap
these attributes in another greenio.GreenPipe, which GreenPipe refuses.
This commit is contained in:
Soren Hansen
2011-02-14 11:10:55 +01:00
parent d4b22b3288
commit cead243901

View File

@@ -27,7 +27,7 @@ class Popen(subprocess_orig.Popen):
# eventlet.processes.Process.run() method.
for attr in "stdin", "stdout", "stderr":
pipe = getattr(self, attr)
if pipe is not None:
if pipe is not None and not type(pipe) == greenio.GreenPipe:
wrapped_pipe = greenio.GreenPipe(pipe, pipe.mode, bufsize)
setattr(self, attr, wrapped_pipe)
__init__.__doc__ = subprocess_orig.Popen.__init__.__doc__