mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-27 14:23:18 +03:00
Support both Unix and Windows variants of signal API
This commit is contained in:
parent
729339d2be
commit
2066904b3c
8
main.cpp
8
main.cpp
@ -14,7 +14,10 @@ void handleExitSignal(int sig) {
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
void setupUnixSignals() {
|
||||
void setupSignalHandlers() {
|
||||
#ifdef _WIN32
|
||||
signal(SIGINT, handleExitSignal);
|
||||
#else
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = handleExitSignal;
|
||||
sigset_t signal_mask;
|
||||
@ -22,11 +25,12 @@ void setupUnixSignals() {
|
||||
sa.sa_mask = signal_mask;
|
||||
sa.sa_flags = 0;
|
||||
sigaction(SIGINT, &sa, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
setupUnixSignals();
|
||||
setupSignalHandlers();
|
||||
|
||||
// Don't write .pyc files.
|
||||
qputenv("PYTHONDONTWRITEBYTECODE", "1");
|
||||
|
Loading…
Reference in New Issue
Block a user