| 116 | } |
| 117 | |
| 118 | void cleanup() { |
| 119 | // Reset console display |
| 120 | set_display(reset); |
| 121 | |
| 122 | #if !defined(_WIN32) |
| 123 | // Restore settings on POSIX systems |
| 124 | if (!simple_io) { |
| 125 | if (tty != nullptr) { |
| 126 | out = stdout; |
| 127 | fclose(tty); |
| 128 | tty = nullptr; |
| 129 | } |
| 130 | tcsetattr(STDIN_FILENO, TCSANOW, &initial_state); |
| 131 | } |
| 132 | #endif |
| 133 | } |
| 134 | |
| 135 | // |
| 136 | // Display and IO |