Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mod byte_buffer;
use crate::adb_monitor::{AdbMonitor, AdbMonitorCallback};
use std::env;
use std::process::Command;
use std::thread;

struct AutoAdb {
command: Vec<String>,
Expand All @@ -40,9 +41,17 @@ impl AdbMonitorCallback for AutoAdb {
})
.collect::<Vec<_>>();
println!("Detected device {}", serial);
let process = Command::new(&cmd[0]).args(cmd.iter().skip(1)).spawn();
if let Err(err) = process {
eprintln!("Could not execute {:?}: {}", cmd, err);
match Command::new(&cmd[0]).args(cmd.iter().skip(1)).spawn() {
Ok(mut child) => {
thread::spawn(move || {
if let Err(err) = child.wait() {
eprintln!("Could not wait child process: {}", err);
}
});
}
Err(err) => {
eprintln!("Could not execute {:?}: {}", cmd, err);
}
}
}
}
Expand Down