'doesn\'t work remotely with rpyc. use read_loop and write instead'

def interact(self):

    try:
        mfd = self.master.fileno()
        fd = sys.stdin.fileno()
        fdo = sys.stdout.fileno()
        f = os.fdopen(fd, 'r')
        old_settings = termios.tcgetattr(fd)
        try:
            tty.setraw(fd)
            not_eof = True
            while not_eof:
                (r, _, x) = select.select([sys.stdin, self.master], [], [sys.stdin, self.master], None)
                if (self.master in r):
                    data = os.read(mfd, 1024)
                    if data:
                        os.write(fdo, data)
                    else:
                        not_eof = False
                if (sys.stdin in r):
                    ch = os.read(fd, 1)
                    if ch:
                        os.write(mfd, ch)
                    else:
                        not_eof = False
                self.prog.poll()
                if (self.prog.returncode is not None):
                    not_eof = False
                    sys.stdout.write('\n')
        finally:
            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
    finally:
        self.close()
