From 9c5517fd25f17130b7da46d8acb1e0f02c961cda Mon Sep 17 00:00:00 2001 From: nom3ad <19239479+nom3ad@users.noreply.github.com> Date: Sun, 6 Nov 2022 15:05:32 +0530 Subject: [PATCH] use custom RWPair instead of io.BufferedRWPair --- sshuttle/client.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sshuttle/client.py b/sshuttle/client.py index c097086..0523fde 100644 --- a/sshuttle/client.py +++ b/sshuttle/client.py @@ -310,7 +310,22 @@ class FirewallClient: import io self.p.stdin.write(b'STDIO:\n') self.p.stdin.flush() - return io.BufferedRWPair(self.p.stdout, self.p.stdin, 1) + class RWPair: + def __init__(self, r, w): + self.r = r + self.w = w + self.read = r.read + self.readline = r.readline + self.write = w.write + self.flush = w.flush + def close(self): + for f in self.r, self.w: + try: + f.close() + except: + pass + return RWPair(self.p.stdout, self.p.stdin) + # return io.BufferedRWPair(self.p.stdout, self.p.stdin, 1) else: import base64 (s1, s2) = socket.socketpair()