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

@ -4,7 +4,6 @@ use std::{
fs::{File, OpenOptions},
io::{Read, Seek, SeekFrom, Write},
path::{Path, PathBuf},
process::Command,
};
use linux_bzimage_builder::{
@ -17,7 +16,7 @@ use crate::{
bin::{AsterBin, AsterBinType, AsterBzImageMeta, AsterElfMeta},
file::BundleFile,
},
util::{get_current_crates, hard_link_or_copy},
util::{get_current_crates, hard_link_or_copy, new_command_checked_exists},
};
pub fn make_install_bzimage(
@ -95,7 +94,7 @@ pub fn make_elf_for_qemu(install_dir: impl AsRef<Path>, elf: &AsterBin, strip: b
if strip {
// We use rust-strip to reduce the kernel image size.
let status = Command::new("rust-strip")
let status = new_command_checked_exists("rust-strip")
.arg(elf.path())
.arg("-o")
.arg(result_elf_path.as_os_str())
@ -170,7 +169,7 @@ fn install_setup_with_arch(
}
let target_dir = std::fs::canonicalize(target_dir).unwrap();
let mut cmd = Command::new("cargo");
let mut cmd = new_command_checked_exists("cargo");
let mut rustflags = vec![
"-Cdebuginfo=2",
"-Ccode-model=kernel",