Merge branch 'fix/openocd-prints-old-logs' into 'master'

tools: fix openocd old logs print

See merge request espressif/esp-idf!20176
This commit is contained in:
Roland Dobai 2022-09-22 15:21:07 +08:00
commit a1eee69e8f

View File

@ -78,10 +78,8 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
time.sleep(0.1) time.sleep(0.1)
else: else:
p.kill() p.kill()
if target + '_outfile_name' in processes: if target + '_outfile_name' in processes and target == 'openocd':
if target == 'openocd': print(_check_for_common_openocd_issues(processes[target + '_outfile_name'], print_all=False))
print(_check_for_common_openocd_issues(processes[target + '_outfile_name'], print_all=False))
os.unlink(processes[target + '_outfile_name'])
except Exception as e: except Exception as e:
print(e) print(e)
print('Failed to close/kill {}'.format(target)) print('Failed to close/kill {}'.format(target))
@ -179,7 +177,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
local_dir = project_desc['build_dir'] local_dir = project_desc['build_dir']
args = ['openocd'] + shlex.split(openocd_arguments) args = ['openocd'] + shlex.split(openocd_arguments)
openocd_out_name = os.path.join(local_dir, OPENOCD_OUT_FILE) openocd_out_name = os.path.join(local_dir, OPENOCD_OUT_FILE)
openocd_out = open(openocd_out_name, 'a+') openocd_out = open(openocd_out_name, 'w')
try: try:
process = subprocess.Popen(args, stdout=openocd_out, stderr=subprocess.STDOUT, bufsize=1) process = subprocess.Popen(args, stdout=openocd_out, stderr=subprocess.STDOUT, bufsize=1)
except Exception as e: except Exception as e:
@ -222,7 +220,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
if gdbgui_port is not None: if gdbgui_port is not None:
args += ['--port', gdbgui_port] args += ['--port', gdbgui_port]
gdbgui_out_name = os.path.join(local_dir, GDBGUI_OUT_FILE) gdbgui_out_name = os.path.join(local_dir, GDBGUI_OUT_FILE)
gdbgui_out = open(gdbgui_out_name, 'a+') gdbgui_out = open(gdbgui_out_name, 'w')
env = os.environ.copy() env = os.environ.copy()
# The only known solution for https://github.com/cs01/gdbgui/issues/359 is to set the following environment # The only known solution for https://github.com/cs01/gdbgui/issues/359 is to set the following environment
# variable. The greenlet package cannot be downgraded for compatibility with other requirements (gdbgui, # variable. The greenlet package cannot be downgraded for compatibility with other requirements (gdbgui,