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
1
2
from argparse import ArgumentParser
2
3
3
4
import code42cli .securitydata .main as securitydata
4
5
from code42cli .compat import str
5
6
from code42cli .profile import profile
6
7
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
+
7
19
8
20
def main ():
9
21
code42_arg_parser = ArgumentParser ()
You can’t perform that action at this time.
0 commit comments