parser.add_argument('mal_cmd', nargs="*",
help="Mal implementation command line. Use '--' to "
"specify a Mal command line with dashed options.")
+parser.add_argument('--crlf', dest='crlf', action='store_true',
+ help="Write \\r\\n instead of \\n to the input")
class Runner():
- def __init__(self, args, no_pty=False):
+ def __init__(self, args, no_pty=False, line_break="\n"):
#print "args: %s" % repr(args)
self.no_pty = no_pty
self.buf = ""
self.last_prompt = ""
+ self.line_break = line_break
+
def read_to_prompt(self, prompts, timeout):
end_time = time.time() + timeout
while time.time() < end_time:
def _to_bytes(s):
return bytes(s, "utf-8") if IS_PY_3 else s
- self.stdin.write(_to_bytes(str.replace('\r', '\x16\r') + "\n"))
+ self.stdin.write(_to_bytes(str.replace('\r', '\x16\r') + self.line_break))
def cleanup(self):
#print "cleaning up"
if args.log_file: log_file = open(args.log_file, "a")
if args.debug_file: debug_file = open(args.debug_file, "a")
-r = Runner(args.mal_cmd, no_pty=args.no_pty)
+r = Runner(args.mal_cmd, no_pty=args.no_pty, line_break="\r\n" if args.crlf else "\n")
t = TestReader(args.test_file)