1import sys 2 3 4def split(command): 5 command = command.strip() 6 return command.rsplit(" ", 1) 7 8 9def command_function(debugger, command, exe_ctx, result, internal_dict): 10 result.SetImmediateOutputFile(sys.__stdout__) 11 print("this is a test string, just a test string", file=result) 12 13 14def write_file(debugger, command, exe_ctx, result, internal_dict): 15 args = split(command) 16 path = args[0] 17 mode = args[1] 18 with open(path, mode) as f: 19 result.SetImmediateOutputFile(f) 20 if not mode in ["r"]: 21 print("writing to file with mode: " + mode, file=result) 22