From 904812d7186c22b81b4417a39b898f0d95f56db5 Mon Sep 17 00:00:00 2001 From: Isaac Elmer <122501927+IsaacUtah1379@users.noreply.github.com> Date: Wed, 1 Jan 2025 03:44:13 -0700 Subject: [PATCH 1/2] Allow PowerJS instantiation when profile load time exceeds 500 ms --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 0cdffe8..7580973 100644 --- a/index.js +++ b/index.js @@ -187,7 +187,7 @@ export class PowerJS { } else { this.#working = false; // Powershell Session is initiated! clearTimeout(this.#timeouts.start); - assert(this.#readerr.length, 0, "Powershell init has an error!"); + assert(this.#readerr.replaceAll(/Loading personal and system profiles took \d+ms./g, '').length, 0, "Powershell init has an error!"); } // No process() because we need to bypass introduction data (like Powershell version...) this.#readout = ""; From 5792fcd634ec1bda3b7493ea9cd8717154c0ab58 Mon Sep 17 00:00:00 2001 From: Isaac Elmer <122501927+IsaacUtah1379@users.noreply.github.com> Date: Wed, 1 Jan 2025 04:02:14 -0700 Subject: [PATCH 2/2] Trim leftover whitespace --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7580973..ce9f3bd 100644 --- a/index.js +++ b/index.js @@ -187,7 +187,7 @@ export class PowerJS { } else { this.#working = false; // Powershell Session is initiated! clearTimeout(this.#timeouts.start); - assert(this.#readerr.replaceAll(/Loading personal and system profiles took \d+ms./g, '').length, 0, "Powershell init has an error!"); + assert(this.#readerr.replaceAll(/Loading personal and system profiles took \d+ms\./g, '').trim().length, 0, "Powershell init has an error!"); } // No process() because we need to bypass introduction data (like Powershell version...) this.#readout = "";