mirror of
https://github.com/zizmorcore/zizmor.git
synced 2025-12-23 08:47:33 +00:00
feat: improve panic handling in CI environments (#1307)
This commit is contained in:
parent
ade712d8a8
commit
96a96bcc89
2 changed files with 22 additions and 1 deletions
|
|
@ -804,7 +804,25 @@ fn run(app: &mut App) -> Result<ExitCode, Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
human_panic::setup_panic!();
|
// NOTE: We only use human-panic on non-CI environments.
|
||||||
|
// This is because human-panic's output gets sent to a temporary file,
|
||||||
|
// which is then typically inaccessible from an already failed
|
||||||
|
// CI job. In those cases, it's better to dump directly to stderr,
|
||||||
|
// since that'll typically be captured by console logging.
|
||||||
|
if std::env::var_os("CI").is_some() {
|
||||||
|
std::panic::set_hook(Box::new(|info| {
|
||||||
|
let trace = std::backtrace::Backtrace::force_capture();
|
||||||
|
eprintln!("FATAL: zizmor crashed. This is a bug that should be reported.");
|
||||||
|
eprintln!(
|
||||||
|
"Please report to: {repo}",
|
||||||
|
repo = env!("CARGO_PKG_REPOSITORY")
|
||||||
|
);
|
||||||
|
eprintln!("Panic information:\n{}", info);
|
||||||
|
eprintln!("Backtrace:\n{}", trace);
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
human_panic::setup_panic!();
|
||||||
|
}
|
||||||
|
|
||||||
let mut app = App::parse();
|
let mut app = App::parse();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ of `zizmor`.
|
||||||
|
|
||||||
* The [concurrency-limits] audit no longer flags explicit user concurrency
|
* The [concurrency-limits] audit no longer flags explicit user concurrency
|
||||||
overrides, e.g. `cancel-in-progress: false` (#1302)
|
overrides, e.g. `cancel-in-progress: false` (#1302)
|
||||||
|
* zizmor now detects CI environments and specializes its panic handling
|
||||||
|
accordingly, improving the quality of panic reports when running
|
||||||
|
in CI (#1307)
|
||||||
|
|
||||||
## 1.16.1
|
## 1.16.1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue