Skip to content

Commit

Permalink
tools: fix openocd old logs print
Browse files Browse the repository at this point in the history
  • Loading branch information
Lapshin committed Sep 21, 2022
1 parent 087f9c0 commit 4539020
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tools/idf_py_actions/debug_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ def _terminate_async_target(target: str) -> None:
time.sleep(0.1)
else:
p.kill()
if target + '_outfile_name' in processes:
if target == 'openocd':
print(_check_for_common_openocd_issues(processes[target + '_outfile_name'], print_all=False))
os.unlink(processes[target + '_outfile_name'])
if target + '_outfile_name' in processes and target == 'openocd':
print(_check_for_common_openocd_issues(processes[target + '_outfile_name'], print_all=False))
except Exception as e:
print(e)
print('Failed to close/kill {}'.format(target))
Expand Down Expand Up @@ -179,7 +177,7 @@ def openocd(action: str, ctx: Context, args: PropertyDict, openocd_scripts: Opti
local_dir = project_desc['build_dir']
args = ['openocd'] + shlex.split(openocd_arguments)
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:
process = subprocess.Popen(args, stdout=openocd_out, stderr=subprocess.STDOUT, bufsize=1)
except Exception as e:
Expand Down Expand Up @@ -222,7 +220,7 @@ def gdbui(action: str, ctx: Context, args: PropertyDict, gdbgui_port: Optional[s
if gdbgui_port is not None:
args += ['--port', gdbgui_port]
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()
# 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,
Expand Down

0 comments on commit 4539020

Please sign in to comment.