xtask: tolerate curl failure when possible

Codex sandbox forbids network access.
reviewable/pr1369/r32
Tamir Duberstein 1 week ago
parent 667790e103
commit 0cb52e850a
No known key found for this signature in database

@ -208,7 +208,7 @@ pub(crate) fn run(opts: Options) -> Result<()> {
let etag_path_exists = etag_path.try_exists().with_context(|| {
format!("failed to check existence of {}", etag_path.display())
})?;
if !dest_path_exists && etag_path_exists {
if dest_path_exists != etag_path_exists {
println!(
"cargo:warning=({}).exists()={} != ({})={} (mismatch)",
dest_path.display(),
@ -237,8 +237,15 @@ pub(crate) fn run(opts: Options) -> Result<()> {
.with_context(|| format!("failed to run {curl:?}"))?;
let Output { status, .. } = &output;
if status.code() != Some(0) {
if dest_path_exists {
println!(
"cargo:warning={curl:?} failed ({status:?}); using cached {}",
dest_path.display()
);
} else {
bail!("{curl:?} failed: {output:?}")
}
}
let mut patch = Command::new("patch");
patch

Loading…
Cancel
Save