mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-06 22:24:33 +02:00
Merge branch 'bugfix/ctrlc_port_detection' into 'master'
tools: allow to interrupt port detection Closes IDF-6656 See merge request espressif/esp-idf!22062
This commit is contained in:
10
tools/idf.py
10
tools/idf.py
@@ -20,13 +20,11 @@ import json
|
|||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import signal
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from collections import Counter, OrderedDict, _OrderedDictKeysView
|
from collections import Counter, OrderedDict, _OrderedDictKeysView
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from pkgutil import iter_modules
|
from pkgutil import iter_modules
|
||||||
from types import FrameType
|
|
||||||
from typing import Any, Callable, Dict, List, Optional, Union
|
from typing import Any, Callable, Dict, List, Optional, Union
|
||||||
|
|
||||||
# pyc files remain in the filesystem when switching between branches which might raise errors for incompatible
|
# pyc files remain in the filesystem when switching between branches which might raise errors for incompatible
|
||||||
@@ -689,15 +687,7 @@ def init_cli(verbose_output: List=None) -> Any:
|
|||||||
return CLI(help=cli_help, verbose_output=verbose_output, all_actions=all_actions)
|
return CLI(help=cli_help, verbose_output=verbose_output, all_actions=all_actions)
|
||||||
|
|
||||||
|
|
||||||
def signal_handler(_signal: int, _frame: Optional[FrameType]) -> None:
|
|
||||||
# The Ctrl+C processed by other threads inside
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
# Processing of Ctrl+C event for all threads made by main()
|
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
|
||||||
|
|
||||||
# Check the environment only when idf.py is invoked regularly from command line.
|
# Check the environment only when idf.py is invoked regularly from command line.
|
||||||
checks_output = None if SHELL_COMPLETE_RUN else check_environment()
|
checks_output = None if SHELL_COMPLETE_RUN else check_environment()
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
import sys
|
import sys
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
@@ -151,7 +152,14 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict:
|
|||||||
monitor_args += ['-m', ' '.join("'%s'" % a for a in idf_py)]
|
monitor_args += ['-m', ' '.join("'%s'" % a for a in idf_py)]
|
||||||
hints = False # Temporarily disabled because of https://github.com/espressif/esp-idf/issues/9610
|
hints = False # Temporarily disabled because of https://github.com/espressif/esp-idf/issues/9610
|
||||||
|
|
||||||
RunTool('idf_monitor', monitor_args, args.project_dir, build_dir=args.build_dir, hints=hints, interactive=True)()
|
# Temporally ignore SIGINT, which is used in idf_monitor to spawn gdb.
|
||||||
|
old_handler = signal.getsignal(signal.SIGINT)
|
||||||
|
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||||
|
|
||||||
|
try:
|
||||||
|
RunTool('idf_monitor', monitor_args, args.project_dir, build_dir=args.build_dir, hints=hints, interactive=True)()
|
||||||
|
finally:
|
||||||
|
signal.signal(signal.SIGINT, old_handler)
|
||||||
|
|
||||||
def flash(action: str, ctx: click.core.Context, args: PropertyDict) -> None:
|
def flash(action: str, ctx: click.core.Context, args: PropertyDict) -> None:
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user