Skip to content

Commit 1b8da50

Browse files
RazeLighter777ggerganov
authored andcommitted
fixed color reset on exit (#149)
* fixed color reset on exit * added sigint handler for ansi_color_reset * Update main.cpp --------- Co-authored-by: Georgi Gerganov <[email protected]>
1 parent 3b8d57e commit 1b8da50

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ static bool is_interacting = false;
755755

756756
#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
757757
void sigint_handler(int signo) {
758+
printf(ANSI_COLOR_RESET);
758759
if (signo == SIGINT) {
759760
if (!is_interacting) {
760761
is_interacting=true;
@@ -1052,5 +1053,9 @@ int main(int argc, char ** argv) {
10521053

10531054
ggml_free(model.ctx);
10541055

1056+
if (params.use_color) {
1057+
printf(ANSI_COLOR_RESET);
1058+
}
1059+
10551060
return 0;
10561061
}

0 commit comments

Comments
 (0)