examples : flush log upon ctrl+c

This commit is contained in:
Georgi Gerganov 2024-09-20 10:06:38 +03:00
parent 722ec1eb51
commit e9d8ebaa2c
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 10 additions and 0 deletions

View file

@ -97,6 +97,11 @@ static void sigint_handler(int signo) {
LOG("\n");
gpt_perf_print(*g_ctx, *g_smpl);
write_logfile(*g_ctx, *g_params, *g_model, *g_input_tokens, g_output_ss->str(), *g_output_tokens);
// make sure all logs are flushed
LOG("Interrupted by user\n");
gpt_log_pause(gpt_log_main());
_exit(130);
}
}

View file

@ -116,6 +116,11 @@ static void sigint_handler(int signo) {
LOG("\n");
gpt_perf_print(*g_ctx, *g_smpl);
write_logfile(*g_ctx, *g_params, *g_model, *g_input_tokens, g_output_ss->str(), *g_output_tokens);
// make sure all logs are flushed
LOG("Interrupted by user\n");
gpt_log_pause(gpt_log_main());
_exit(130);
}
}