From daafeb2fa837ef16e549350aea48761bfadcfb25 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Fri, 26 Apr 2024 15:17:49 +0500 Subject: [PATCH] setup: retry postinstall commands 3 times --- scripts/bootstrap.mjs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/bootstrap.mjs b/scripts/bootstrap.mjs index 2f695d680..7e3246f3d 100644 --- a/scripts/bootstrap.mjs +++ b/scripts/bootstrap.mjs @@ -153,7 +153,15 @@ async function bootstrapPackage(cwd, outputs) { postInstallCommands.push(`npm run postinstall `); for (const cmd of postInstallCommands) { - await execute(cmd, cwd, outputs); + let retries = 3; + while (retries > 0) { + try { + await execute(cmd, cwd, outputs); + break; + } catch (e) { + console.error(e); + } + } } }