@@ -0,0 +1,1999 @@
+#!/usr/bin/python3%0A%0Aimport io%0Aimport pexpect%0Aimport string%0Aimport sys%0Aimport time%0A%0Asys.stdin = io.TextIOWrapper(sys.stdin.detach(), newline='')%0A%0Aoutput_to=sys.stdout%0A%0Aargs = list(sys.argv%5B1:%5D)%0Alogfile = open(args.pop(0), %22w%22)%0Achild = pexpect.spawn(' '.join(args))%0A%0Adef output_line(line_bits, last_skip):%0A  line = %22%22.join(line_bits)%0A  sline = line.strip()%0A%0A  skip = True%0A  if line.startswith(%22 %22):%0A    skip = False%0A%0A  if len(sline) %3E 0:%0A    if sline%5B0%5D in string.ascii_uppercase:%0A      skip = False%0A    if sline%5B0%5D in ('%5B', '=', '!', '+'):%0A      skip = False%0A%0A  if skip != last_skip:%0A    output_to.write('%5Cn')%0A%0A  if skip:%0A    output_to.write('.')%0A  else:%0A    output_to.write(line)%0A%0A  output_to.flush()%0A  line_bits.clear()%0A  return skip%0A%0A%0Adef find_newline(data):%0A  fulldata = b%22%22.join(data)%0A  newlinechar = fulldata.find(b'%5Cn')%0A  retlinechar = fulldata.find(b'%5Cr')%0A%0A  if newlinechar == -1:%0A    newlinechar = len(fulldata)+1%0A  if retlinechar == -1:%0A    retlinechar = len(fulldata)+1%0A%0A  if retlinechar+1 == newlinechar:%0A    splitpos = newlinechar%0A  else:%0A    splitpos = min(newlinechar, retlinechar)%0A%0A  if splitpos %3E len(fulldata):%0A    return%0A%0A  newline = fulldata%5B:splitpos+1%5D%0A  leftover = fulldata%5Bsplitpos+1:%5D%0A%0A  data.clear()%0A  data.append(leftover)%0A  return newline%0A%0A%0Alast_skip = False%0Acont = %5B%5D%0Adata = %5Bb''%5D%0Awhile True:%0A  line = None%0A  while len(data) %3E 1 or len(data%5B0%5D) %3E 0 or child.isalive():%0A    line = find_newline(data)%0A    if line is not None:%0A      break%0A    try:%0A      data.append(child.read_nonblocking(100))%0A    except pexpect.TIMEOUT:%0A      pass%0A    except pexpect.EOF as e:%0A      data.append(b'%5Cn')%0A%0A  if not line:%0A    break%0A%0A  line = line.decode('utf-8')%0A  logfile.write(line)%0A  logfile.flush()%0A%0A  if line.endswith('%5Cr'):%0A    cont.append(line%5B:-1%5D)%0A    last_skip = output_line(cont, last_skip)%0A    cont.append('%5Cr')%0A    continue%0A%0A  sline = line.strip('%5Cn%5Cr')%0A  cont.append(sline)%0A  if sline.endswith('%5C%5C'):%0A    continue%0A%0A  cont.append('%5Cn')%0A  last_skip = output_line(cont, last_skip)%0A

Clean up the travis log output.