Skip to content

Commit

Permalink
tools/mpremote: Make ConsolePosix work without .raw attribute.
Browse files Browse the repository at this point in the history
When running mpremote in the vscode terminal on OSX the sys.stdout.buffer
does not have the raw attribute.  It works fine without it.
  • Loading branch information
andrewleech authored and dpgeorge committed Feb 4, 2022
1 parent 1f84440 commit d865ca5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/mpremote/mpremote/console.py
Expand Up @@ -11,8 +11,13 @@
class ConsolePosix:
def __init__(self):
self.infd = sys.stdin.fileno()
self.infile = sys.stdin.buffer.raw
self.outfile = sys.stdout.buffer.raw
self.infile = sys.stdin.buffer
self.outfile = sys.stdout.buffer
if hasattr(self.infile, "raw"):
self.infile = self.infile.raw
if hasattr(self.outfile, "raw"):
self.outfile = self.outfile.raw

self.orig_attr = termios.tcgetattr(self.infd)

def enter(self):
Expand Down

0 comments on commit d865ca5

Please sign in to comment.