[py-dev] execnet: redirecting stdout and stderr from remote threads
Gordon Wrigley
py-dev at tolomea.com
Fri Jul 10 07:44:53 CEST 2009
I have execnet's stdout and stderr redirecting working and it does a
fine job for the initial thread, but I'm also creating a bunch of
helper threads on the remote end of the connection and I can't figure
out how to get the stdout and stderr for them redirected.
Below is an example of what I thought might work but doesn't.
import py
import sys
code = """
def func():
print 'hello world'
import threading
t=threading.Thread(target=func)
t.start()
t.join()
"""
gateway = py.execnet.SshGateway("localhost")
channel = gateway.remote_exec(code, sys.stdout.write)
channel.waitclose()
Regards Gordon
More information about the Pytest-dev
mailing list