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

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 +28 -5
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -95399,15 +95399,38 @@ 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
- const stdout = (0, import_node_child_process.execSync)("taskkill /IM chrome.exe /F");
95404
- console.log("Result from killing chrome.exe:", stdout.toString());
95405
95423
  try {
95406
- await (0, import_promises3.rm)(userDataDir, { recursive: true, force: true });
95424
+ const stdout = (0, import_node_child_process.execSync)("taskkill /IM chrome.exe /F");
95425
+ console.log("Result from killing chrome.exe:", stdout.toString());
95407
95426
  } catch (e) {
95408
- console.error("Error deleting user data directory:", e);
95409
- throw e;
95427
+ console.error("Error killing chrome.exe:", e);
95410
95428
  }
95429
+ await retryWithExponentialBackoff({
95430
+ fn: () => (0, import_promises3.rm)(userDataDir, { recursive: true, force: true }),
95431
+ initialDelay: 100,
95432
+ maxRetries: 10
95433
+ });
95411
95434
  };
95412
95435
 
95413
95436
  // 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.7",
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",