File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1+ import platform
12from argparse import ArgumentParser
23
34import code42cli .securitydata .main as securitydata
45from code42cli .compat import str
56from code42cli .profile import profile
67
8+ # If on Windows, configure console session to handle ANSI escape sequences correctly
9+ # source: https://bugs.python.org/issue29059
10+ if platform .system ().lower () == "windows" :
11+ from ctypes import windll , c_int , byref
12+
13+ stdout_handle = windll .kernel32 .GetStdHandle (c_int (- 11 ))
14+ mode = c_int (0 )
15+ windll .kernel32 .GetConsoleMode (c_int (stdout_handle ), byref (mode ))
16+ mode = c_int (mode .value | 4 )
17+ windll .kernel32 .SetConsoleMode (c_int (stdout_handle ), mode )
18+
719
820def main ():
921 code42_arg_parser = ArgumentParser ()
You can’t perform that action at this time.
0 commit comments