@@ -78,11 +78,11 @@ def __lookup_cppcheck_exe():
7878def __run_subprocess_tty (args , env = None , cwd = None , timeout = None ):
7979 import pty
8080 mo , so = pty .openpty ()
81- me , se = pty .openpty ()
81+ me , se = pty .openpty ()
8282 p = subprocess .Popen (args , stdout = so , stderr = se , env = env , cwd = cwd )
8383 for fd in [so , se ]:
8484 os .close (fd )
85-
85+
8686 select_timeout = 0.04 # seconds
8787 readable = [mo , me ]
8888 result = {mo : b'' , me : b'' }
@@ -110,15 +110,15 @@ def __run_subprocess_tty(args, env=None, cwd=None, timeout=None):
110110 if p .poll () is None :
111111 p .kill ()
112112 return_code = p .wait ()
113-
113+
114114 stdout = result [mo ]
115- stderr = result [me ]
115+ stderr = result [me ]
116116 return return_code , stdout , stderr
117117
118-
118+
119119def __run_subprocess (args , env = None , cwd = None , timeout = None ):
120120 p = subprocess .Popen (args , stdout = subprocess .PIPE , stderr = subprocess .PIPE , env = env , cwd = cwd )
121-
121+
122122 try :
123123 comm = p .communicate (timeout = timeout )
124124 return_code = p .returncode
@@ -143,9 +143,9 @@ def __run_subprocess(args, env=None, cwd=None, timeout=None):
143143 #os.killpg(os.getpgid(p.pid), signal.SIGTERM) # Send the signal to all the process groups
144144 p .terminate ()
145145 comm = p .communicate ()
146-
146+
147147 stdout = comm [0 ]
148- stderr = comm [1 ]
148+ stderr = comm [1 ]
149149 return return_code , stdout , stderr
150150
151151
@@ -190,13 +190,13 @@ def cppcheck(args, env=None, remove_checkers_report=True, cwd=None, cppcheck_exe
190190 args .append (arg_executor )
191191
192192 logging .info (exe + ' ' + ' ' .join (args ))
193-
193+
194194 run_subprocess = __run_subprocess_tty if tty else __run_subprocess
195195 return_code , stdout , stderr = run_subprocess ([exe ] + args , env = env , cwd = cwd , timeout = timeout )
196-
196+
197197 stdout = stdout .decode (encoding = 'utf-8' , errors = 'ignore' ).replace ('\r \n ' , '\n ' )
198198 stderr = stderr .decode (encoding = 'utf-8' , errors = 'ignore' ).replace ('\r \n ' , '\n ' )
199-
199+
200200 if remove_checkers_report :
201201 if stderr .find ('[checkersReport]\n ' ) > 0 :
202202 start_id = stderr .find ('[checkersReport]\n ' )
0 commit comments