Fix python 2 module not found, catch tty nonsense in windows bash
@@ -40,13 +40,14 @@ import os
try:
import pty
import tty
-except ModuleNotFoundError: # windows
+except ImportError: # windows
pass
import subprocess
import sys
import tempfile
import threading
+import termios
import six
from six.moves import queue, shlex_quote
@@ -63,8 +64,12 @@ class Tee(object):
@classmethod
def pty(cls, sync_dst_file, *async_dst_files):
master_fd, slave_fd = pty.openpty()
- # raw mode so carriage returns etc. don't get added by the terminal driver
+ # raw mode so carriage returns etc. don't get added by the terminal driver,
+ # bash for windows blows up on this so we catch the error and do nothing
+ try:
tty.setraw(master_fd)
+ except termios.error:
+ pass
master = os.fdopen(master_fd, 'rb')
tee = cls(master, sync_dst_file, *async_dst_files)
tee.tee_file = os.fdopen(slave_fd, 'wb')
