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