component_debug/cli/
explore.rs1use crate::explore::*;
6use crate::query::get_cml_moniker_from_query;
7use anyhow::Result;
8use flex_client::ProxyHasDomain;
9use {flex_fuchsia_dash as fdash, flex_fuchsia_sys2 as fsys};
10
11pub async fn explore_cmd(
12 query: String,
13 ns_layout: DashNamespaceLayout,
14 command: Option<String>,
15 tools_urls: Vec<String>,
16 dash_launcher: fdash::LauncherProxy,
17 realm_query: fsys::RealmQueryProxy,
18 stdout: socket_to_stdio::Stdout<'_>,
19) -> Result<()> {
20 let moniker = get_cml_moniker_from_query(&query, &realm_query).await?;
21 println!("Moniker: {}", moniker);
22
23 let (client, server) = realm_query.domain().create_stream_socket();
24
25 explore_over_socket(moniker, server, tools_urls, command, ns_layout, &dash_launcher).await?;
26
27 #[cfg(not(feature = "fdomain"))]
28 #[allow(clippy::large_futures)]
29 socket_to_stdio::connect_socket_to_stdio(client, stdout).await?;
30
31 #[cfg(feature = "fdomain")]
32 #[allow(clippy::large_futures)]
33 socket_to_stdio::connect_fdomain_socket_to_stdio(client, stdout).await?;
34
35 let exit_code = wait_for_shell_exit(&dash_launcher).await?;
36
37 std::process::exit(exit_code);
38}