From ce6f0959d155b3e85693abc2b94a130713d01427 Mon Sep 17 00:00:00 2001 From: Garrett Date: Wed, 20 Sep 2023 10:36:22 -0700 Subject: [PATCH 1/4] Update testPyinstallerExecutable.js --- tests/testPyinstallerExecutable.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/testPyinstallerExecutable.js b/tests/testPyinstallerExecutable.js index 4611dba7a..643c3b1d1 100644 --- a/tests/testPyinstallerExecutable.js +++ b/tests/testPyinstallerExecutable.js @@ -22,21 +22,27 @@ let now = Date.now(); let outputCollection = ""; -const regex = /.+Error: .+/; +const regex = /.+Error: .+/i; // Check for error messages (without case sensitivity) + +function onMessage(data, id) { + const message = data.toString(); + console.error(`[${id}] ${message}`); + outputCollection += message; + if (regex.test(message)) throw new Error(outputCollection); +} function handleProcess(proc, id = "process") { if (proc != null) { + // Listen for errors from Python process - proc.stderr.on("data", function (data) { - const message = data.toString(); - console.error(`[${id}] Error: ${data}`); - outputCollection += message; - if (regex.test(message)) throw new Error(outputCollection); - }); + proc.stderr.on("data", (data) => onMessage(data, id)); proc.stdout.on("data", function (data) { - console.log(`Time to Start: ${(Date.now() - now).toFixed(2)}ms`); - if (!cmds.forever) process.exit(); + if (cmds.forever) onMessage(data, id) + else { + console.log(`Time to Start: ${(Date.now() - now).toFixed(2)}ms`); + process.exit(); + } }); const error = () => () => { From 149cbf6a4755315e9f445c822ef61f0bd641867a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:37:34 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/testPyinstallerExecutable.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/testPyinstallerExecutable.js b/tests/testPyinstallerExecutable.js index 643c3b1d1..59f8bc83a 100644 --- a/tests/testPyinstallerExecutable.js +++ b/tests/testPyinstallerExecutable.js @@ -33,12 +33,11 @@ function onMessage(data, id) { function handleProcess(proc, id = "process") { if (proc != null) { - // Listen for errors from Python process proc.stderr.on("data", (data) => onMessage(data, id)); proc.stdout.on("data", function (data) { - if (cmds.forever) onMessage(data, id) + if (cmds.forever) onMessage(data, id); else { console.log(`Time to Start: ${(Date.now() - now).toFixed(2)}ms`); process.exit(); From 4761ec740caeaf4a6130b34f2da5aad9eb57514a Mon Sep 17 00:00:00 2001 From: Garrett Date: Wed, 20 Sep 2023 10:38:36 -0700 Subject: [PATCH 3/4] Update testPyinstallerExecutable.js --- tests/testPyinstallerExecutable.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/testPyinstallerExecutable.js b/tests/testPyinstallerExecutable.js index 643c3b1d1..d090ce9ca 100644 --- a/tests/testPyinstallerExecutable.js +++ b/tests/testPyinstallerExecutable.js @@ -28,7 +28,10 @@ function onMessage(data, id) { const message = data.toString(); console.error(`[${id}] ${message}`); outputCollection += message; - if (regex.test(message)) throw new Error(outputCollection); + if (regex.test(message)) { + if (cmds.forever) console.error(outputCollection) + else throw new Error(outputCollection); + } } function handleProcess(proc, id = "process") { From 16f8e210a9ba7f19499a22dfb4b8cfc9267656a2 Mon Sep 17 00:00:00 2001 From: Garrett Date: Wed, 20 Sep 2023 10:39:50 -0700 Subject: [PATCH 4/4] Update testPyinstallerExecutable.js --- tests/testPyinstallerExecutable.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/testPyinstallerExecutable.js b/tests/testPyinstallerExecutable.js index d090ce9ca..1c2e68249 100644 --- a/tests/testPyinstallerExecutable.js +++ b/tests/testPyinstallerExecutable.js @@ -20,18 +20,12 @@ handleProcess(proc2, "spawn"); let now = Date.now(); -let outputCollection = ""; - const regex = /.+Error: .+/i; // Check for error messages (without case sensitivity) function onMessage(data, id) { const message = data.toString(); - console.error(`[${id}] ${message}`); - outputCollection += message; - if (regex.test(message)) { - if (cmds.forever) console.error(outputCollection) - else throw new Error(outputCollection); - } + if (!cmds.forever && regex.test(message)) throw new Error(message); + else console.error(`[${id}] ${message}`); } function handleProcess(proc, id = "process") {