]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/custom_command.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / functionalities / command_script_immediate_output / custom_command.py
1 from __future__ import print_function
2
3 import sys
4 import shlex
5
6 def command_function(debugger, command, exe_ctx, result, internal_dict):
7         result.SetImmediateOutputFile(sys.__stdout__)
8         print('this is a test string, just a test string', file=result)
9
10 def write_file(debugger, command, exe_ctx, result, internal_dict):
11         args = shlex.split(command)
12         path = args[0]
13         mode = args[1]
14         with open(path, mode) as f:
15             result.SetImmediateOutputFile(f)
16             if not mode in ['r']:
17                 print('writing to file with mode: ' + mode, file=result)