Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions install/uvm_install_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ pub trait InstallHandler {
Ok(())
}
}

pub fn handle_notfound(program: &str, e: std::io::Error) -> Error {
if let std::io::ErrorKind::NotFound = e.kind() {
error!("Error: '{0}' command not found.\nuvm requires '{0}' to install modules. Please ensure '{0}' is installed and accessible in your PATH.", program);
}
e.into()
}
12 changes: 8 additions & 4 deletions install/uvm_install_core/src/sys/linux/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ impl ModulePkgInstaller {
.arg(installer)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;
.spawn()
.map_err(|e| handle_notfound("7z", e))?;

let output = child.wait_with_output()?;
if !output.status.success() {
Expand Down Expand Up @@ -59,7 +60,8 @@ impl ModulePkgInstaller {
.arg("-iu")
.current_dir(destination)
.stdin(Stdio::piped())
.spawn()?;
.spawn()
.map_err(|e| handle_notfound("cpio", e))?;
{
let stdin = cpio.stdin.as_mut().ok_or("Failed to open cpio stdin")?;
let mut file = File::open(payload)?;
Expand All @@ -72,13 +74,15 @@ impl ModulePkgInstaller {
.arg("-dc")
.arg(payload)
.stdout(Stdio::piped())
.spawn()?;
.spawn()
.map_err(|e| handle_notfound("gzip", e))?;

let mut cpio = Command::new("cpio")
.arg("-iu")
.current_dir(destination)
.stdin(Stdio::piped())
.spawn()?;
.spawn()
.map_err(|e| handle_notfound("cpio", e))?;
{
let gzip_stdout = gzip.stdout.as_mut().ok_or("Failed to open gzip stdout")?;
let cpio_stdin = cpio.stdin.as_mut().ok_or("Failed to open cpio stdin")?;
Expand Down
3 changes: 2 additions & 1 deletion install/uvm_install_core/src/sys/linux/xz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ impl<V, I> Installer<V, Xz, I> {
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()?;
.spawn()
.map_err(|e| handle_notfound("tar", e))?;

let tar_output = tar_child.wait_with_output()?;
if !tar_output.status.success() {
Expand Down