From c29c699d1f80271d7a4a85fc8e69fa49efa96735 Mon Sep 17 00:00:00 2001 From: fabian Date: Sat, 4 Jan 2025 00:43:40 +0100 Subject: [PATCH] Log errors with adb --- packages/cli/src/serve/handle.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/cli/src/serve/handle.rs b/packages/cli/src/serve/handle.rs index 1a722d639f..864e259079 100644 --- a/packages/cli/src/serve/handle.rs +++ b/packages/cli/src/serve/handle.rs @@ -128,7 +128,7 @@ impl AppHandle { // https://developer.android.com/studio/run/emulator-commandline Platform::Android => { - self.open_android_sim(envs).await?; + self.open_android_sim(envs).await; None } @@ -486,7 +486,7 @@ impl AppHandle { unimplemented!("dioxus-cli doesn't support ios devices yet.") } - async fn open_android_sim(&self, envs: Vec<(&'static str, String)>) -> Result<()> { + async fn open_android_sim(&self, envs: Vec<(&'static str, String)>) { let apk_path = self.app.apk_path(); let full_mobile_app_name = self.app.build.krate.full_mobile_app_name(); @@ -494,20 +494,23 @@ impl AppHandle { tokio::task::spawn(async move { // Install // adb install -r app-debug.apk - let _output = Command::new("adb") + if let Err(e) = Command::new("adb") .arg("install") .arg("-r") .arg(apk_path) .stderr(Stdio::piped()) .stdout(Stdio::piped()) .output() - .await?; + .await + { + tracing::error!("Failed to install apk with `adb`: {e}"); + }; // eventually, use the user's MainAcitivty, not our MainAcitivty // adb shell am start -n dev.dioxus.main/dev.dioxus.main.MainActivity let activity_name = format!("{}/dev.dioxus.main.MainActivity", full_mobile_app_name,); - let _output = Command::new("adb") + if let Err(e) = Command::new("adb") .arg("shell") .arg("am") .arg("start") @@ -517,11 +520,10 @@ impl AppHandle { .stderr(Stdio::piped()) .stdout(Stdio::piped()) .output() - .await?; - - Result::<()>::Ok(()) + .await + { + tracing::error!("Failed to start app with `adb`: {e}"); + }; }); - - Ok(()) } }