From a432e6f8633624ef9f9c319d017caf0e21e839b4 Mon Sep 17 00:00:00 2001 From: Xuan Son Nguyen Date: Tue, 23 Jun 2026 22:57:20 +0200 Subject: [PATCH] use destructor instead --- tools/cli/cli-context.h | 3 +++ tools/cli/cli.cpp | 7 +------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/cli/cli-context.h b/tools/cli/cli-context.h index 99c65cdac4..775895cce2 100644 --- a/tools/cli/cli-context.h +++ b/tools/cli/cli-context.h @@ -35,6 +35,9 @@ struct cli_context { bool has_video = false; cli_context(const common_params & params) : params(params) {} + ~cli_context() { + shutdown(); + } // connect to --server-base or spawn a local llama-server child; // argc/argv are needed to forward the server-relevant args to the child diff --git a/tools/cli/cli.cpp b/tools/cli/cli.cpp index e832f903e5..71a4828ad7 100644 --- a/tools/cli/cli.cpp +++ b/tools/cli/cli.cpp @@ -59,13 +59,8 @@ int llama_cli(int argc, char ** argv) { cli_context ctx_cli(params); if (!ctx_cli.init()) { - ctx_cli.shutdown(); return 1; } - int ret = ctx_cli.run(); - - ctx_cli.shutdown(); - - return ret; + return ctx_cli.run(); }