mirror of
https://github.com/Swatinem/rust-cache
synced 2026-11-23 21:34:18 +00:00
fix: catch spawn failures in the macOS purge workaround (#403)
@actions/exec loses errors thrown synchronously by spawn (e.g. EPERM on sandboxed runners), so the try/catch never fires and the post step exits before saving the cache. execFile passes them to the caller.
This commit is contained in:
+3
-2
@@ -1,5 +1,6 @@
|
||||
import * as core from "@actions/core";
|
||||
import * as exec from "@actions/exec";
|
||||
import { execFile } from "child_process";
|
||||
import { promisify } from "util";
|
||||
|
||||
import { cleanBin, cleanGit, cleanRegistry, cleanTargetDir } from "./cleanup.js";
|
||||
import { CacheConfig, isCacheUpToDate } from "./config.js";
|
||||
@@ -94,6 +95,6 @@ async function macOsWorkaround() {
|
||||
try {
|
||||
// Workaround for https://github.com/actions/cache/issues/403
|
||||
// Also see https://github.com/rust-lang/cargo/issues/8603
|
||||
await exec.exec("sudo", ["/usr/sbin/purge"], { silent: true });
|
||||
await promisify(execFile)("sudo", ["/usr/sbin/purge"]);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user