From decca56522854e222db32f288f03634caa8b88a8 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Wed, 28 Feb 2024 11:21:54 -0600 Subject: [PATCH 01/13] source remove tempo --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index d8d09c6..0627ffd 100644 --- a/server.js +++ b/server.js @@ -43,7 +43,7 @@ ipc.serve(function () { }); ipc.server.on("data", async (data, socket) => { - await spawnShell(data, socket); + // await spawnShell(data, socket); spawnInterpreter(data, socket); }); }); From 65a82ae8fbc15f0db766428fa3b1a2ce0d4a2885 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Wed, 28 Feb 2024 20:55:30 -0600 Subject: [PATCH 02/13] some logs --- server.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server.js b/server.js index 0627ffd..884e0fa 100644 --- a/server.js +++ b/server.js @@ -80,6 +80,7 @@ const spawnInterpreter = function (data, socket) { } child.on("error", function (e) { + console.log("error", e.toString()); ipc.server.emit( socket, JSON.stringify({ @@ -90,8 +91,11 @@ const spawnInterpreter = function (data, socket) { }); child.stdout.on("data", async (data) => { + console.log("some data"); let dataToSend = data.toString(); + console.log("data to send", dataToSend); + if (stripAnsi(last(dataToSend.split("\n"))) === "> ") { console.log("!!!!!! > Detected"); From defaa09f24d0d935ca8eeb4a9c84e07bf8dff9f7 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:03:11 -0600 Subject: [PATCH 03/13] some more logs --- server.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server.js b/server.js index 884e0fa..2eedc9e 100644 --- a/server.js +++ b/server.js @@ -130,6 +130,8 @@ const spawnInterpreter = function (data, socket) { step += 1; } + console.log("sending data"); + ipc.server.emit( socket, JSON.stringify({ @@ -137,9 +139,12 @@ const spawnInterpreter = function (data, socket) { message: dataToSend, }) ); + + console.log("sent data"); }); child.stderr.on("data", (data) => { + console.log("stderr?", data.toString()); ipc.server.emit( socket, JSON.stringify({ @@ -271,6 +276,8 @@ function stripAnsi(string) { throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); } + console.log("stripansi", string); + return string.replace(ansiRegex, ""); } From dc2948d10c3c9efe37f3d601264121ad9871446e Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:18:43 -0600 Subject: [PATCH 04/13] without shell true --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 2eedc9e..e4903d5 100644 --- a/server.js +++ b/server.js @@ -64,7 +64,7 @@ const spawnInterpreter = function (data, socket) { ["--os", "-ci", `"${ci}"`, "--api_key", args[1]], { env: { ...process.env }, // FORCE_COLOR: true, will enable advanced rendering - shell: true, + // shell: true, windowsHide: true, } ); From 661d110649748321e52824cb4a4fed3185db6092 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:23:33 -0600 Subject: [PATCH 05/13] show windows --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index e4903d5..94ae649 100644 --- a/server.js +++ b/server.js @@ -64,8 +64,8 @@ const spawnInterpreter = function (data, socket) { ["--os", "-ci", `"${ci}"`, "--api_key", args[1]], { env: { ...process.env }, // FORCE_COLOR: true, will enable advanced rendering - // shell: true, - windowsHide: true, + shell: true, + // windowsHide: true, } ); } catch (e) { From 0be4f918b471e253f3f01735d41d4acb8a81a311 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:27:37 -0600 Subject: [PATCH 06/13] see with detached --- server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server.js b/server.js index 94ae649..d9e3725 100644 --- a/server.js +++ b/server.js @@ -65,6 +65,7 @@ const spawnInterpreter = function (data, socket) { { env: { ...process.env }, // FORCE_COLOR: true, will enable advanced rendering shell: true, + detached: true, // windowsHide: true, } ); From 13e5480baea8c844fcf3cad07dc946b979279e21 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Wed, 28 Feb 2024 21:55:41 -0600 Subject: [PATCH 07/13] no detach --- server.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server.js b/server.js index d9e3725..2eedc9e 100644 --- a/server.js +++ b/server.js @@ -65,8 +65,7 @@ const spawnInterpreter = function (data, socket) { { env: { ...process.env }, // FORCE_COLOR: true, will enable advanced rendering shell: true, - detached: true, - // windowsHide: true, + windowsHide: true, } ); } catch (e) { From a14713934a67598338e2d34c04ae5ecefa969a3f Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Thu, 29 Feb 2024 19:41:42 -0600 Subject: [PATCH 08/13] pythonencoding --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 2eedc9e..6fca9f2 100644 --- a/server.js +++ b/server.js @@ -63,7 +63,7 @@ const spawnInterpreter = function (data, socket) { `interpreter`, ["--os", "-ci", `"${ci}"`, "--api_key", args[1]], { - env: { ...process.env }, // FORCE_COLOR: true, will enable advanced rendering + env: { ...process.env, PYTHONIOENCODING: "utf-8" }, // FORCE_COLOR: true, will enable advanced rendering shell: true, windowsHide: true, } From db9792e342d62e94693f8322fef68812a6f62e5a Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Thu, 29 Feb 2024 19:48:05 -0600 Subject: [PATCH 09/13] remove some unnecessary logs --- server.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/server.js b/server.js index 6fca9f2..0394ab3 100644 --- a/server.js +++ b/server.js @@ -57,8 +57,6 @@ const spawnInterpreter = function (data, socket) { const args = JSON.parse(data.toString()); text = args[0]; - console.log("args1", args[1]); - child = spawn( `interpreter`, ["--os", "-ci", `"${ci}"`, "--api_key", args[1]], @@ -69,7 +67,6 @@ const spawnInterpreter = function (data, socket) { } ); } catch (e) { - console.log("caught", e); ipc.server.emit( socket, JSON.stringify({ @@ -80,7 +77,6 @@ const spawnInterpreter = function (data, socket) { } child.on("error", function (e) { - console.log("error", e.toString()); ipc.server.emit( socket, JSON.stringify({ @@ -91,17 +87,13 @@ const spawnInterpreter = function (data, socket) { }); child.stdout.on("data", async (data) => { - console.log("some data"); let dataToSend = data.toString(); - console.log("data to send", dataToSend); - if (stripAnsi(last(dataToSend.split("\n"))) === "> ") { console.log("!!!!!! > Detected"); let data = text.split(" "); console.log("text is", text); - console.log(text); list = markdownToListArray(text); @@ -130,8 +122,6 @@ const spawnInterpreter = function (data, socket) { step += 1; } - console.log("sending data"); - ipc.server.emit( socket, JSON.stringify({ @@ -139,12 +129,9 @@ const spawnInterpreter = function (data, socket) { message: dataToSend, }) ); - - console.log("sent data"); }); child.stderr.on("data", (data) => { - console.log("stderr?", data.toString()); ipc.server.emit( socket, JSON.stringify({ @@ -238,8 +225,6 @@ const spawnShell = function (data, socket) { child.stdout.on("data", async (data) => { let dataToSend = data.toString(); - console.log("dataToSend", dataToSend); - ipc.server.emit( socket, JSON.stringify({ @@ -276,8 +261,6 @@ function stripAnsi(string) { throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); } - console.log("stripansi", string); - return string.replace(ansiRegex, ""); } From 19b31fe16a1ec81581e3f4e951690a9358c42333 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Fri, 1 Mar 2024 12:57:25 -0600 Subject: [PATCH 10/13] store result in c: directory --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 0394ab3..496e058 100644 --- a/server.js +++ b/server.js @@ -102,7 +102,7 @@ const spawnInterpreter = function (data, socket) { // ); list.push( - 'Summarize the result of the the previous steps. You do not need to strictly comply with instruction steps for the test to pass. Workarounds are irrelevant to the test passing or failing. Say either "The test failed." or "The test passed.". Then in a new paragraph that is 3 sentences long explain how you came to that conclusion. Save this result into /tmp/oiResult.log' + 'Summarize the result of the the previous steps. You do not need to strictly comply with instruction steps for the test to pass. Workarounds are irrelevant to the test passing or failing. Say either "The test failed." or "The test passed.". Then in a new paragraph that is 3 sentences long explain how you came to that conclusion. Save this result into C:\\oiResult.log' ); console.log("!!!!!! list", list); From b835a79b0593ce9f54cedc55ee9cdf1bd4050208 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Fri, 1 Mar 2024 22:21:47 -0600 Subject: [PATCH 11/13] line break --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 496e058..694a399 100644 --- a/server.js +++ b/server.js @@ -114,7 +114,7 @@ const spawnInterpreter = function (data, socket) { } else { console.log("RUNNING COMMAND ", i); let command = list[i]; - child.stdin.write(`${command}\n`); + child.stdin.write(`${command}\r\n`); dataToSend += command; i++; } From 9d7d6a6993b212e7f34c99fbdfeb4910f851e5e5 Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Mon, 4 Mar 2024 21:59:20 -0600 Subject: [PATCH 12/13] add prerun --- server.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index 694a399..5e596d5 100644 --- a/server.js +++ b/server.js @@ -43,7 +43,7 @@ ipc.serve(function () { }); ipc.server.on("data", async (data, socket) => { - // await spawnShell(data, socket); + await spawnShell(data, socket); spawnInterpreter(data, socket); }); }); @@ -164,12 +164,12 @@ const spawnShell = function (data, socket) { console.log( "spawning ", - `source ~/actions-runner/_work/testdriver/testdriver/.testdriver/prerun.sh` + `C:\\actions-runner\\_work\\testdriver\\testdriver\\.testdriver\\prerun.ps1` ); child = spawn( - `source`, - ["~/actions-runner/_work/testdriver/testdriver/.testdriver/prerun.sh"], + `C:\\actions-runner\\_work\\testdriver\\testdriver\\.testdriver\\prerun.ps1`, + [], { env: { ...process.env }, // FORCE_COLOR: true, will enable advanced rendering shell: true, From 192cd3c7752358e169cf05f02a2af56dd917b88c Mon Sep 17 00:00:00 2001 From: tpikachu <46133358+tpikachu@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:40:06 -0600 Subject: [PATCH 13/13] use powershell for spawn --- server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 5e596d5..fea0878 100644 --- a/server.js +++ b/server.js @@ -168,8 +168,10 @@ const spawnShell = function (data, socket) { ); child = spawn( - `C:\\actions-runner\\_work\\testdriver\\testdriver\\.testdriver\\prerun.ps1`, - [], + "powershell", + [ + `C:\\actions-runner\\_work\\testdriver\\testdriver\\.testdriver\\prerun.ps1`, + ], { env: { ...process.env }, // FORCE_COLOR: true, will enable advanced rendering shell: true,