mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 05:34:32 +02:00
idf.py.exe changes to handle Ctrl+C in correct way.
Handling Ctrl+C in correct way for gdbstubs.
This commit is contained in:
12
tools/idf.py
12
tools/idf.py
@@ -39,6 +39,9 @@ from collections import Counter, OrderedDict
|
|||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from pkgutil import iter_modules
|
from pkgutil import iter_modules
|
||||||
|
|
||||||
|
import signal
|
||||||
|
|
||||||
|
|
||||||
# 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
|
||||||
# idf.py extensions. Therefore, pyc file generation is turned off:
|
# idf.py extensions. Therefore, pyc file generation is turned off:
|
||||||
sys.dont_write_bytecode = True
|
sys.dont_write_bytecode = True
|
||||||
@@ -723,7 +726,16 @@ def init_cli(verbose_output=None):
|
|||||||
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, frame):
|
||||||
|
# The Ctrl+C processed by other threads inside
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
# Processing of Ctrl+C event for all threads made by main()
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
checks_output = check_environment()
|
checks_output = check_environment()
|
||||||
cli = init_cli(verbose_output=checks_output)
|
cli = init_cli(verbose_output=checks_output)
|
||||||
# the argument `prog_name` must contain name of the file - not the absolute path to it!
|
# the argument `prog_name` must contain name of the file - not the absolute path to it!
|
||||||
|
@@ -16,6 +16,9 @@
|
|||||||
#include <shlwapi.h>
|
#include <shlwapi.h>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define LINESIZE 1024
|
#define LINESIZE 1024
|
||||||
|
|
||||||
@@ -43,6 +46,17 @@ BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
|
||||||
|
{
|
||||||
|
switch (fdwCtrlType) {
|
||||||
|
// Handle the CTRL-C signal.
|
||||||
|
case CTRL_C_EVENT:
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, LPTSTR argv[])
|
int main(int argc, LPTSTR argv[])
|
||||||
{
|
{
|
||||||
/* Print the version of this wrapper tool, but only if invoked as "idf.exe".
|
/* Print the version of this wrapper tool, but only if invoked as "idf.exe".
|
||||||
|
Reference in New Issue
Block a user