From 2f5ea52dec17456839a0ffae7c5b1260de53a5c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Nov 2025 00:06:56 +0000 Subject: [PATCH 1/2] Initial plan From a33102e7e361dceca0679348ae3fdbea7957d6fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 16 Nov 2025 00:16:30 +0000 Subject: [PATCH 2/2] Fix issue #55: Wrap commands with shell to support 'deno task' and other complex commands Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com> --- lib/core/runner.ts | 7 +++- .../core/test-data/deno-task-test/deno.json | 5 +++ .../core/test-data/deno-task-test/hello.ts | 1 + test/core/runner.test.ts | 32 +++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 lib/test/core/test-data/deno-task-test/deno.json create mode 100644 lib/test/core/test-data/deno-task-test/hello.ts diff --git a/lib/core/runner.ts b/lib/core/runner.ts index a2f12ab..fd1b86a 100644 --- a/lib/core/runner.ts +++ b/lib/core/runner.ts @@ -157,7 +157,12 @@ class Runner extends BaseRunner { * @returns The command to be executed. */ private prepareCommand(env?: Record) { - let child = $.raw`${this.processConfig.cmd!}`.stdout("piped").stderr("piped") + // Execute command through a shell to handle complex commands like "deno task", + // pipes, redirects, and other shell features + const shell = CurrentOS === OperatingSystem.Windows ? "cmd" : "sh" + const shellArg = CurrentOS === OperatingSystem.Windows ? "/c" : "-c" + + let child = $`${shell} ${shellArg} ${this.processConfig.cmd!}`.stdout("piped").stderr("piped") if (this.processConfig.cwd) child = child.cwd(this.processConfig.cwd) if (env) child = child.env(env) diff --git a/lib/test/core/test-data/deno-task-test/deno.json b/lib/test/core/test-data/deno-task-test/deno.json new file mode 100644 index 0000000..68f6197 --- /dev/null +++ b/lib/test/core/test-data/deno-task-test/deno.json @@ -0,0 +1,5 @@ +{ + "tasks": { + "hello": "deno run hello.ts" + } +} diff --git a/lib/test/core/test-data/deno-task-test/hello.ts b/lib/test/core/test-data/deno-task-test/hello.ts new file mode 100644 index 0000000..8f738c6 --- /dev/null +++ b/lib/test/core/test-data/deno-task-test/hello.ts @@ -0,0 +1 @@ +console.log("hello-from-deno-task") diff --git a/test/core/runner.test.ts b/test/core/runner.test.ts index ca42f46..d297cb2 100644 --- a/test/core/runner.test.ts +++ b/test/core/runner.test.ts @@ -70,3 +70,35 @@ test("Runner handles commands with pipes and redirects", async () => { // Stop and cleanup await pup.terminate(2500) }) + +test("Runner executes actual 'deno task' commands correctly (issue #55)", async () => { + const TEST_PROCESS_ID = "test-actual-deno-task" + const TEST_PROCESS_COMMAND = "deno task hello" + const TEST_CWD = new URL("../../lib/test/core/test-data/deno-task-test/", import.meta.url).pathname + + const config: Configuration = { + processes: [ + { + "id": TEST_PROCESS_ID, + "cmd": TEST_PROCESS_COMMAND, + "cwd": TEST_CWD, + }, + ], + } + const pup = new Pup(config) + await pup.init() + + // Find process + const testProcess = pup.processes.findLast((p) => p.getConfig().id === TEST_PROCESS_ID) + assertEquals(testProcess !== undefined, true) + + // Start process + const startResult = pup.start(TEST_PROCESS_ID, "test") + assertEquals(startResult, true) + + // Wait a moment for process to complete + await new Promise((resolve) => setTimeout(resolve, 1000)) + + // Stop and cleanup + await pup.terminate(2500) +})