interactive mode: print '\n' in sigint_handler, this flush stdout thus ensure color reset. (#283)

This commit is contained in:
Qingyou Meng 2023-03-20 02:10:00 +08:00 committed by GitHub
parent 0b366e7357
commit 084e2f0ec0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -747,6 +747,7 @@ static bool is_interacting = false;
#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) || defined (_WIN32)
void sigint_handler(int signo) {
printf(ANSI_COLOR_RESET);
printf("\n"); // this also force flush stdout.
if (signo == SIGINT) {
if (!is_interacting) {
is_interacting=true;