mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 16:01:42 +00:00
fix(uv): log stdout on uv pip install error (#6702)
Signed-off-by: pyranota <pyra@duck.com>
This commit is contained in:
@@ -1927,12 +1927,21 @@ pub async fn handle_python_reqs(
|
||||
}
|
||||
};
|
||||
|
||||
let mut stderr_buf = String::new();
|
||||
let mut stderr_pipe = uv_install_proccess
|
||||
.stderr()
|
||||
.take()
|
||||
.ok_or(anyhow!("Cannot take stderr from uv_install_proccess"))?;
|
||||
let stderr_future = stderr_pipe.read_to_string(&mut stderr_buf);
|
||||
let (mut stderr_buf, mut stdout_buf) = Default::default();
|
||||
let (mut stderr_pipe, mut stdout_pipe) = (
|
||||
uv_install_proccess
|
||||
.stderr()
|
||||
.take()
|
||||
.ok_or(anyhow!("Cannot take stderr from uv_install_proccess"))?,
|
||||
uv_install_proccess
|
||||
.stdout()
|
||||
.take()
|
||||
.ok_or(anyhow!("Cannot take stdout from uv_install_proccess"))?
|
||||
);
|
||||
let (stderr_future, stdout_future) = (
|
||||
stderr_pipe.read_to_string(&mut stderr_buf),
|
||||
stdout_pipe.read_to_string(&mut stdout_buf)
|
||||
);
|
||||
|
||||
if let Some(pid) = pids.lock().await.get_mut(i) {
|
||||
*pid = uv_install_proccess.id();
|
||||
@@ -1950,10 +1959,10 @@ pub async fn handle_python_reqs(
|
||||
pids.lock().await.get_mut(i).and_then(|e| e.take());
|
||||
return Err(anyhow::anyhow!("uv pip install was canceled"));
|
||||
},
|
||||
(_, exitstatus) = async {
|
||||
(_, _, exitstatus) = async {
|
||||
// See tokio::process::Child::wait_with_output() for more context
|
||||
// Sometimes uv_install_proccess.wait() is not exiting if stderr is not awaited before it :/
|
||||
(stderr_future.await, Box::into_pin(uv_install_proccess.wait()).await)
|
||||
(stderr_future.await, stdout_future.await, Box::into_pin(uv_install_proccess.wait()).await)
|
||||
} => match exitstatus {
|
||||
Ok(status) => if !status.success() {
|
||||
tracing::warn!(
|
||||
@@ -1967,7 +1976,7 @@ pub async fn handle_python_reqs(
|
||||
&job_id,
|
||||
w_id,
|
||||
format!(
|
||||
"\nError while installing {}:\n{stderr_buf}",
|
||||
"\nError while installing {}: \nStderr:\n{stderr_buf}\nStdout:\n{stdout_buf}",
|
||||
&req
|
||||
),
|
||||
&conn,
|
||||
|
||||
Reference in New Issue
Block a user