Make OSDK errors clear if commands don't exist

This commit is contained in:
Zhang Junyang
2025-06-13 11:19:00 +08:00
committed by Tate, Hongliang Tian
parent 4a9977d9a7
commit f3f0e9a244
13 changed files with 97 additions and 25 deletions

View File

@ -3,9 +3,8 @@
use crate::{
cli::DebugArgs,
commands::util::bin_file_name,
util::{get_kernel_crate, get_target_directory},
util::{get_kernel_crate, get_target_directory, new_command_checked_exists},
};
use std::process::Command;
pub fn execute_debug_command(_profile: &str, args: &DebugArgs) {
let remote = &args.remote;
@ -16,7 +15,7 @@ pub fn execute_debug_command(_profile: &str, args: &DebugArgs) {
.join(bin_file_name());
println!("Debugging {}", file_path.display());
let mut gdb = Command::new("gdb");
let mut gdb = new_command_checked_exists("gdb");
gdb.args([
format!("{}", file_path.display()).as_str(),
"-ex",
@ -27,7 +26,7 @@ pub fn execute_debug_command(_profile: &str, args: &DebugArgs) {
#[test]
fn have_gdb_installed() {
let output = Command::new("gdb").arg("--version").output();
let output = new_command_checked_exists("gdb").arg("--version").output();
assert!(output.is_ok(), "Failed to run gdb");
let stdout = String::from_utf8_lossy(&output.unwrap().stdout).to_string();
assert!(stdout.contains("GNU gdb"));