tenseleyflow/gitswitch / 8e86927

Browse files

fix: flush stdout after display_status to ensure output is shown

Without fflush, the final status message could be lost if the
program exits before the output buffer is flushed.
Authored by espadonne
SHA
8e8692773df70e2478f0676f0117babf2d290949
Parents
97dd06c
Tree
fd6253e

1 changed file

StatusFile+-
M src/display.c 2 1
src/display.cmodified
@@ -182,12 +182,13 @@ void display_status(const char *level, const char *message, ...) {
182182
     }
183183
     
184184
     if (strlen(formatted_message) > 0) {
185
-        printf("%s %s\n", 
185
+        printf("%s %s\n",
186186
                display_colorize(icon, color_type),
187187
                display_colorize(formatted_message, color_type));
188188
     } else {
189189
         printf("%s\n", display_colorize(icon, color_type));
190190
     }
191
+    fflush(stdout);
191192
 }
192193
 
193194
 /* Print error message with context */