method: execnet.SocketGateway.remote_redirect

 return a handle representing a redirection of a remote 
            end's stdout to a local file object.  with handle.close() 
            the redirection will be reverted.   
        
    def remote_redirect(self, stdout=None, stderr=None): 

origin: Gateway

where:

function source:

def remote_redirect(self, stdout=None, stderr=None): 
    """ return a handle representing a redirection of a remote 
            end's stdout to a local file object.  with handle.close() 
            the redirection will be reverted.   
        """ 
    clist = []
    for name, out in ('stdout', stdout), ('stderr', stderr): 
        if out: 
            outchannel = self.newchannel()
            outchannel.setcallback(getattr(out, 'write', out))
            channel = self.remote_exec(""" 
                    import sys
                    outchannel = channel.receive() 
                    outchannel.gateway.ThreadOut(sys, %r).setdefaultwriter(outchannel.send)
                """ % name) 
            channel.send(outchannel)
            clist.append(channel)
    for c in clist: 
        c.waitclose(1.0) 
    class Handle: 
        def close(_): 
            for name, out in ('stdout', stdout), ('stderr', stderr): 
                if out: 
                    c = self.remote_exec("""
                            import sys
                            channel.gateway.ThreadOut(sys, %r).resetdefault()
                        """ % name) 
                    c.waitclose(1.0) 
    return Handle()

call sites:

called in /home/johnny/projects/merlinux/py/dist/py/execnet/testing/test_gateway.py

traceback execnet.SocketGateway.remote_redirect.0