Skip to content

Commit b020fcd

Browse files
authored
x509-cert: better debug info when zlint isn't installed (#1018)
1 parent e74ef5e commit b020fcd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

x509-cert/test-support/src/zlint.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66
collections::HashMap,
77
fmt,
88
fs::File,
9-
io::{Read, Write},
9+
io::{self, Read, Write},
1010
process::{Command, Stdio},
1111
};
1212
use tempfile::tempdir;
@@ -159,7 +159,13 @@ pub fn check_certificate(pem: &[u8], ignored: &[&str]) {
159159
.stderr(Stdio::inherit())
160160
.stdout(Stdio::piped())
161161
.spawn()
162-
.expect("zlint failed");
162+
.unwrap_or_else(|e| match e.kind() {
163+
io::ErrorKind::NotFound => {
164+
panic!("error running 'zlint': command not found. Is it installed?")
165+
}
166+
_ => panic!("error running 'zlint': {:?}", e),
167+
});
168+
163169
let mut stdout = child.stdout.take().unwrap();
164170
let exit_status = child.wait().expect("get zlint status");
165171

0 commit comments

Comments
 (0)