mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
feat(cli): include stderr in command error
This commit is contained in:
7
.changes/include-stderr-error.md
Normal file
7
.changes/include-stderr-error.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@tauri-apps/cli": patch:enhance
|
||||
"tauri-cli": patch:enhance
|
||||
"tauri-bundler": patch:enhance
|
||||
---
|
||||
|
||||
When a captured command fails, include its stderr in the error message.
|
||||
@@ -102,9 +102,10 @@ impl CommandExt for Command {
|
||||
if output.status.success() {
|
||||
Ok(output)
|
||||
} else {
|
||||
Err(crate::Error::GenericError(format!(
|
||||
"failed to run {program}"
|
||||
)))
|
||||
Err(crate::Error::CommandFailed {
|
||||
command: program,
|
||||
error: std::io::Error::other(String::from_utf8_lossy(&output.stderr).to_string()),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,10 +411,10 @@ impl CommandExt for Command {
|
||||
if output.status.success() {
|
||||
Ok(output)
|
||||
} else {
|
||||
crate::error::bail!(
|
||||
"failed to run command `{cmdline}`: command exited with status code {}",
|
||||
output.status.code().unwrap_or(-1)
|
||||
);
|
||||
Err(crate::error::Error::CommandFailed {
|
||||
command: cmdline,
|
||||
error: std::io::Error::other(String::from_utf8_lossy(&output.stderr).to_string()),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user