Skip to content

Commit 7f88c7f

Browse files
committed
also write a failure marker if archive creation failed (#391)
Windows tought me that this can definitely happen as well.
1 parent e7b2d8f commit 7f88c7f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/tools/src/lib.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,30 @@ pub fn scripted_fixture_repo_read_only_with_args(
173173
.env("GIT_CONFIG_VALUE_1", "main")
174174
.output()?;
175175
if !output.status.success() {
176-
std::fs::write(failure_marker, &[]).ok();
176+
write_failure_marker(&failure_marker);
177177
}
178178
assert!(
179179
output.status.success(),
180180
"repo script failed: stdout: {}\nstderr: {}",
181181
output.stdout.as_bstr(),
182182
output.stderr.as_bstr()
183183
);
184-
create_archive_if_not_on_ci(&script_result_directory, &archive_file_path, script_identity)?;
184+
create_archive_if_not_on_ci(&script_result_directory, &archive_file_path, script_identity).map_err(
185+
|err| {
186+
write_failure_marker(&failure_marker);
187+
err
188+
},
189+
)?;
185190
}
186191
}
187192
}
188193
Ok(script_result_directory)
189194
}
190195

196+
fn write_failure_marker(failure_marker: &Path) {
197+
std::fs::write(failure_marker, &[]).ok();
198+
}
199+
191200
/// The `script_identity` will be baked into the soon to be created `archive` as it identitifies the script
192201
/// that created the contents of `source_dir`.
193202
fn create_archive_if_not_on_ci(source_dir: &Path, archive: &Path, script_identity: u32) -> std::io::Result<()> {

0 commit comments

Comments
 (0)