Skip to content

Commit

Permalink
fixed color reset on exit (ggerganov#149)
Browse files Browse the repository at this point in the history
* fixed color reset on exit

* added sigint handler for ansi_color_reset

* Update main.cpp

---------

Co-authored-by: Georgi Gerganov <[email protected]>
  • Loading branch information
2 people authored and bitRAKE committed Mar 17, 2023
1 parent 7533d2f commit 4026886
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ static bool is_interacting = false;

#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) || defined (_WIN32)
void sigint_handler(int signo) {
printf(ANSI_COLOR_RESET);
if (signo == SIGINT) {
if (!is_interacting) {
is_interacting=true;
Expand Down Expand Up @@ -1059,5 +1060,9 @@ int main(int argc, char ** argv) {

ggml_free(model.ctx);

if (params.use_color) {
printf(ANSI_COLOR_RESET);
}

return 0;
}

0 comments on commit 4026886

Please sign in to comment.