| 42 | |
| 43 | #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) || defined (_WIN32) |
| 44 | static void signal_handler(int) { |
| 45 | if (g_is_interrupted.load()) { |
| 46 | // second Ctrl+C - exit immediately |
| 47 | // make sure to clear colors before exiting (not using LOG or console.cpp here to avoid deadlock) |
| 48 | fprintf(stdout, "\033[0m\n"); |
| 49 | fflush(stdout); |
| 50 | std::exit(130); |
| 51 | } |
| 52 | g_is_interrupted.store(true); |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | struct cli_context { |