@@ -140,16 +140,19 @@ Rounds = 100
140
140
141
141
pub fn check_certificate ( pem : & [ u8 ] , ignored : & [ & str ] ) {
142
142
let tmp_dir = tempdir ( ) . expect ( "create tempdir" ) ;
143
- let config_path = tmp_dir. path ( ) . join ( "config .toml" ) ;
144
- let cert_path = tmp_dir. path ( ) . join ( "cert .pem" ) ;
143
+ let config_path = tmp_dir. path ( ) . join ( "zlint_config .toml" ) ;
144
+ let cert_path = tmp_dir. path ( ) . join ( "zlint_cert .pem" ) ;
145
145
146
- let mut config_file = File :: create ( & config_path) . expect ( "create config file" ) ;
147
- config_file
148
- . write_all ( ZLINT_CONFIG . as_bytes ( ) )
149
- . expect ( "Create config file" ) ;
150
-
151
- let mut cert_file = File :: create ( & cert_path) . expect ( "create pem file" ) ;
152
- cert_file. write_all ( pem) . expect ( "Create pem file" ) ;
146
+ {
147
+ let mut config_file = File :: create ( & config_path) . expect ( "create config file" ) ;
148
+ config_file
149
+ . write_all ( ZLINT_CONFIG . as_bytes ( ) )
150
+ . expect ( "Create config file" ) ;
151
+ }
152
+ {
153
+ let mut cert_file = File :: create ( & cert_path) . expect ( "create pem file" ) ;
154
+ cert_file. write_all ( pem) . expect ( "Create pem file" ) ;
155
+ }
153
156
154
157
let mut child = Command :: new ( "zlint" )
155
158
. arg ( "-pretty" )
@@ -167,13 +170,16 @@ pub fn check_certificate(pem: &[u8], ignored: &[&str]) {
167
170
} ) ;
168
171
169
172
let mut stdout = child. stdout . take ( ) . unwrap ( ) ;
173
+
174
+ let output_buf = {
175
+ let mut buf = Vec :: new ( ) ;
176
+ stdout. read_to_end ( & mut buf) . expect ( "read zlint output" ) ;
177
+ buf
178
+ } ;
179
+
170
180
let exit_status = child. wait ( ) . expect ( "get zlint status" ) ;
171
181
172
182
assert ! ( exit_status. success( ) , "zlint failed" ) ;
173
- let mut output_buf = Vec :: new ( ) ;
174
- stdout
175
- . read_to_end ( & mut output_buf)
176
- . expect ( "read zlint output" ) ;
177
183
178
184
let output: LintResult = serde_json:: from_slice ( & output_buf) . expect ( "parse zlint output" ) ;
179
185
0 commit comments