44#include " utils/cli_selection_utils.h"
55#include " utils/download_progress.h"
66#include " utils/logging_utils.h"
7+ #include " utils/string_utils.h"
78
89namespace commands {
910bool EngineInstallCmd::Exec (const std::string& engine,
1011 const std::string& version,
1112 const std::string& src) {
12- // Start server if server is not started yet
13- if (!commands::IsServerAlive (host_, port_)) {
14- CLI_LOG (" Starting server ..." );
15- commands::ServerStartCmd ssc;
16- if (!ssc.Exec (host_, port_)) {
17- return false ;
18- }
19- }
2013 // Handle local install, if fails, fallback to remote install
2114 if (!src.empty ()) {
2215 auto res = engine_service_.UnzipEngine (engine, version, src);
@@ -30,6 +23,15 @@ bool EngineInstallCmd::Exec(const std::string& engine,
3023 }
3124 }
3225
26+ // Start server if server is not started yet
27+ if (!commands::IsServerAlive (host_, port_)) {
28+ CLI_LOG (" Starting server ..." );
29+ commands::ServerStartCmd ssc;
30+ if (!ssc.Exec (host_, port_)) {
31+ return false ;
32+ }
33+ }
34+
3335 if (show_menu_) {
3436 DownloadProgress dp;
3537 dp.Connect (host_, port_);
@@ -81,7 +83,10 @@ bool EngineInstallCmd::Exec(const std::string& engine,
8183
8284 std::vector<std::string> variant_selections;
8385 for (const auto & variant : variant_result.value ()) {
84- variant_selections.push_back (variant[" name" ].asString ());
86+ auto v_name = variant[" name" ].asString ();
87+ if (string_utils::StringContainsIgnoreCase (v_name, hw_inf_.sys_inf ->os )) {
88+ variant_selections.push_back (variant[" name" ].asString ());
89+ }
8590 }
8691 auto selected_variant =
8792 cli_selection_utils::PrintSelection (variant_selections);
0 commit comments