Skip to content

Commit bff7cb2

Browse files
authored
ref(js): use fs.rmSync (#1167)
instead of `rm` for better error handling re: recent build fail as a result of a race condition(?)
1 parent 20b0078 commit bff7cb2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

reference/javascript/build.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,9 @@ function pullRemote(remote: Remote, latestSha: string) {
426426
const target = remotePath(remote);
427427
const url = `https://github.com/${remote.repo}/archive/refs/heads/${branch}.tar.gz`;
428428
console.info(`Fetching remote tarball ${remote.repo}/${branch}`);
429-
exec(["rm -rf", target]);
429+
if (fs.existsSync(target)) {
430+
fs.rmSync(target, { recursive: true, force: true });
431+
}
430432
exec(["mkdir -p", target]);
431433
exec([`curl -L -s`, url, `| tar -xz --strip-components=1 -C`, target]);
432434
const shaFile = path.join(target, ".sha");

0 commit comments

Comments
 (0)