]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
fixed color reset on exit (#149)
authorJustin Suess <redacted>
Wed, 15 Mar 2023 19:39:38 +0000 (15:39 -0400)
committerGitHub <redacted>
Wed, 15 Mar 2023 19:39:38 +0000 (21:39 +0200)
* fixed color reset on exit

* added sigint handler for ansi_color_reset

* Update main.cpp

---------

Co-authored-by: Georgi Gerganov <redacted>
main.cpp

index 6dc9ae98036ededc79d234d86515ea2078bf9cc6..6227db6c56617ff8fc7c309d84d7390e43ccdccd 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -755,6 +755,7 @@ static bool is_interacting = false;
 
 #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
 void sigint_handler(int signo) {
+    printf(ANSI_COLOR_RESET);
     if (signo == SIGINT) {
         if (!is_interacting) {
             is_interacting=true;
@@ -1052,5 +1053,9 @@ int main(int argc, char ** argv) {
 
     ggml_free(model.ctx);
 
+    if (params.use_color) {
+        printf(ANSI_COLOR_RESET);
+    }
+
     return 0;
 }