Cleanly error aos_starter when run before starterd
If fetching the status for an application before starterd had started
(and if doing so just for an individual application, rather than for
*all* applications), then aos_starter would segfault. Fail more
gracefully.
Change-Id: Ic4657d303403e116bc836dbf3803e43a533089b1
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/starter/starter_rpc_lib.h b/aos/starter/starter_rpc_lib.h
index 7b93e24..f91fb9e 100644
--- a/aos/starter/starter_rpc_lib.h
+++ b/aos/starter/starter_rpc_lib.h
@@ -97,11 +97,12 @@
std::chrono::milliseconds timeout);
// Fetches the status of the application with the given name. Creates a
-// temporary event loop from the provided config for fetching. Returns an empty
-// flatbuffer if the application is not found.
-const aos::FlatbufferDetachedBuffer<aos::starter::ApplicationStatus> GetStatus(
- std::string_view name, const aos::Configuration *config,
- const aos::Node *node);
+// temporary event loop from the provided config for fetching. Returns nullopt
+// if the application is not found.
+const std::optional<
+ aos::FlatbufferDetachedBuffer<aos::starter::ApplicationStatus>>
+GetStatus(std::string_view name, const aos::Configuration *config,
+ const aos::Node *node);
// Fetches the entire status message of starter. Creates a temporary event loop
// from the provided config for fetching.