@datacamp/learn-vm-scripts 0.0.3-rc.5 → 0.0.3-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.cjs +25 -6
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -95399,15 +95399,34 @@ async function loginToDatabricks({
95399
95399
  // src/resetChrome.ts
95400
95400
  var import_node_child_process = require("node:child_process");
95401
95401
  var import_promises3 = require("node:fs/promises");
95402
+ var retryWithExponentialBackoff = async ({
95403
+ fn,
95404
+ maxRetries,
95405
+ initialDelay
95406
+ }) => {
95407
+ let retries = 0;
95408
+ while (retries < maxRetries) {
95409
+ try {
95410
+ await fn();
95411
+ return;
95412
+ } catch (e) {
95413
+ console.error(`Error in exponential backoff iteration ${retries}:`, e);
95414
+ await new Promise(
95415
+ (resolve5) => setTimeout(resolve5, 2 ** retries * initialDelay)
95416
+ );
95417
+ retries++;
95418
+ }
95419
+ }
95420
+ throw new Error("Max retries exceeded");
95421
+ };
95402
95422
  var resetChrome = async ({ userDataDir }) => {
95403
95423
  const stdout = (0, import_node_child_process.execSync)("taskkill /IM chrome.exe /F");
95404
95424
  console.log("Result from killing chrome.exe:", stdout.toString());
95405
- try {
95406
- await (0, import_promises3.rm)(userDataDir, { recursive: true, force: true });
95407
- } catch (e) {
95408
- console.error("Error deleting user data directory:", e);
95409
- throw e;
95410
- }
95425
+ await retryWithExponentialBackoff({
95426
+ fn: () => (0, import_promises3.rm)(userDataDir, { recursive: true, force: true }),
95427
+ initialDelay: 100,
95428
+ maxRetries: 10
95429
+ });
95411
95430
  };
95412
95431
 
95413
95432
  // src/startInputWatcher.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datacamp/learn-vm-scripts",
3
- "version": "0.0.3-rc.5",
3
+ "version": "0.0.3-rc.6",
4
4
  "repository": "git@github.com:datacamp-engineering/learn-vm-scripts.git",
5
5
  "description": "Scripts used by VMs in learn.",
6
6
  "main": "./dist/index.cjs",