Skip to content

Commit 58cfded

Browse files
committed
only call get_server_exec_path() once
1 parent bfa8bf2 commit 58cfded

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tools/server/server-models.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ server_models::server_models(
140140
int argc,
141141
char ** argv,
142142
char ** envp) : base_params(params) {
143+
server_binary_path = get_server_exec_path().string();
143144
for (int i = 0; i < argc; i++) {
144145
base_args.push_back(std::string(argv[i]));
145146
}
@@ -383,7 +384,7 @@ void server_models::load(const std::string & name, bool auto_load) {
383384
}
384385

385386
// set executable path
386-
child_args[0] = get_server_exec_path().string();
387+
child_args[0] = server_binary_path;
387388

388389
// set model args
389390
add_or_replace_arg(child_args, "--port", std::to_string(inst.meta.port));

tools/server/server-models.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct server_models {
8484
common_params base_params;
8585
std::vector<std::string> base_args;
8686
std::vector<std::string> base_env;
87+
std::string server_binary_path;
8788

8889
void update_meta(const std::string & name, const server_model_meta & meta);
8990

0 commit comments

Comments
 (0)