mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-02 06:51:14 +00:00
Add context to failed uv tool run
(#3882)
These are not covered by `fs_err` and a missing binary otherwise only give a generic "file not found" error.
This commit is contained in:
parent
b12b25db10
commit
063a0a4384
1 changed files with 5 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Result;
|
||||
use anyhow::{Context, Result};
|
||||
use itertools::Itertools;
|
||||
use tempfile::tempdir_in;
|
||||
use tokio::process::Command;
|
||||
|
@ -132,8 +132,10 @@ pub(crate) async fn run(
|
|||
"Running `{command}{space}{}`",
|
||||
args.iter().map(|arg| arg.to_string_lossy()).join(" ")
|
||||
);
|
||||
let mut handle = process.spawn()?;
|
||||
let status = handle.wait().await?;
|
||||
let mut handle = process
|
||||
.spawn()
|
||||
.with_context(|| format!("Failed to spawn: `{command}`"))?;
|
||||
let status = handle.wait().await.context("Child process disappeared")?;
|
||||
|
||||
// Exit based on the result of the command
|
||||
// TODO(zanieb): Do we want to exit with the code of the child process? Probably.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue