Respect application names in starter_client
We were looking for binary names, and finding the wrong applications on
the roboRIO when 2 applications were pointing to the same binary.
If there's an exact application match, use that instead. This makes it
so we can stop message_bridge_client again...
Change-Id: I51d72bfb3a62f69295f38a47fbbd8d7f17a9419b
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/starter/starter_rpc_lib.cc b/aos/starter/starter_rpc_lib.cc
index e373e6b..884367d 100644
--- a/aos/starter/starter_rpc_lib.cc
+++ b/aos/starter/starter_rpc_lib.cc
@@ -41,10 +41,15 @@
return *search;
}
-std::string_view FindApplication(const std::string_view &name,
+std::string_view FindApplication(const std::string_view name,
const aos::Configuration *config) {
std::string_view app_name = name;
for (const auto app : *config->applications()) {
+ if (app->name()->string_view() == name) {
+ return name;
+ }
+ }
+ for (const auto app : *config->applications()) {
if (app->has_executable_name() &&
app->executable_name()->string_view() == name) {
app_name = app->name()->string_view();
diff --git a/aos/starter/starter_rpc_lib.h b/aos/starter/starter_rpc_lib.h
index 3097b5f..eadf5c6 100644
--- a/aos/starter/starter_rpc_lib.h
+++ b/aos/starter/starter_rpc_lib.h
@@ -75,7 +75,7 @@
// Checks if the name is an executable name and if it is, it returns that
// application's name, otherwise returns name as given
-std::string_view FindApplication(const std::string_view &name,
+std::string_view FindApplication(const std::string_view name,
const aos::Configuration *config);
// Sends the given command to the application with the name name. Creates a