How to safely terminate a running console application on shutdown in Windows

久幸 藤井 1 Reputation point
2022-03-02T11:47:19.05+00:00

Hello.
Currently, I am developing a console program that saves data to SQLite3 with Python 3.9.
Is there any way to safely terminate the currently running console application (receive some message and terminate DB processing) in advance when Windows shuts down?
Linux sends a SIGTERM at shutdown so that the application can safely terminate it upon receiving that signal.
Would you please let me know how to handle it on Windows?
I look forward to working with you.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,443 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 40,941 Reputation points
    2022-03-02T11:51:47.853+00:00
    2 people found this answer helpful.
    0 comments No comments