accept event as ctrl+c as well, because GenerateConsoleCtrlEvent doesn't work form a non-parent-console process
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4551 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
dd306c7798
commit
755bc11826
1 changed files with 29 additions and 2 deletions
|
@ -79,6 +79,34 @@ static void sigint(int sig)
|
||||||
quit();
|
quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
static DWORD WINAPI sigint_event_msg_handler(LPVOID)
|
||||||
|
{
|
||||||
|
HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, "makensis win32 signint event");
|
||||||
|
|
||||||
|
if (hEvent)
|
||||||
|
{
|
||||||
|
if (WaitForSingleObject(hEvent, INFINITE) == WAIT_OBJECT_0)
|
||||||
|
raise(SIGINT);
|
||||||
|
CloseHandle(hEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void init_signals()
|
||||||
|
{
|
||||||
|
atexit(myatexit);
|
||||||
|
signal(SIGINT,sigint);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
DWORD id;
|
||||||
|
HANDLE hThread = CreateThread(NULL, 0, sigint_event_msg_handler, NULL, 0, &id);
|
||||||
|
if (hThread) CloseHandle(hThread);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void print_logo()
|
static void print_logo()
|
||||||
{
|
{
|
||||||
fprintf(g_output,"MakeNSIS %s - Copyright 1999-2006 Nullsoft, Inc.\n"
|
fprintf(g_output,"MakeNSIS %s - Copyright 1999-2006 Nullsoft, Inc.\n"
|
||||||
|
@ -284,8 +312,7 @@ int main(int argc, char **argv)
|
||||||
print_logo();
|
print_logo();
|
||||||
}
|
}
|
||||||
|
|
||||||
atexit(myatexit);
|
init_signals();
|
||||||
signal(SIGINT,sigint);
|
|
||||||
|
|
||||||
if (!g_output) g_output=stdout;
|
if (!g_output) g_output=stdout;
|
||||||
while (argpos < argc)
|
while (argpos < argc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue