diff --git a/src/cook/fs.rs b/src/cook/fs.rs index 36c6d349c5..df8a5df95c 100644 --- a/src/cook/fs.rs +++ b/src/cook/fs.rs @@ -201,7 +201,7 @@ pub fn run_command(mut command: process::Command, stdout_pipe: &PtyOut) -> Resul .map_err(wrap_io_err!("waiting to exit"))?; if !status.success() { - return Err(Error::Command(command, status)); + return Err(Error::Command(Box::new((command, status)))); } Ok(()) @@ -289,7 +289,7 @@ pub fn run_command_stdin( let status = child.wait().map_err(wrap_io_err!("Spawning"))?; if !status.success() { - return Err(Error::Command(command, status)); + return Err(Error::Command(Box::new((command, status)))); } Ok(()) diff --git a/src/cook/package.rs b/src/cook/package.rs index 57b3658cc2..9d6ec94751 100644 --- a/src/cook/package.rs +++ b/src/cook/package.rs @@ -158,7 +158,7 @@ pub fn package_toml( pkgar_core::Packaging::LZMA2 => { let mut size = header .total_size() - .map_err(|e| Error::Pkgar(pkgar::Error::Core(e)))? + .map_err(|e| Error::Pkgar(Box::new(pkgar::Error::Core(e))))? as u64; let entries = package .read_entries() diff --git a/src/lib.rs b/src/lib.rs index f47b36ade1..4025493a44 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,9 +43,9 @@ pub enum Error { dst: PathBuf, context: &'static str, }, - Command(Command, ExitStatus), + Command(Box<(Command, ExitStatus)>), Package(pkg::PackageError), - Pkgar(pkgar::Error), + Pkgar(Box), Other(String), } @@ -86,7 +86,8 @@ impl Display for Error { source ) } - Error::Command(command, exit_status) => { + Error::Command(boxed) => { + let (command, exit_status) = &**boxed; write!( f, "Failed to run [{:?}]: exited with status {}", @@ -174,7 +175,7 @@ impl From for Error { path, context, }, - _ => Error::Pkgar(value), + _ => Error::Pkgar(Box::new(value)), } } }