From 19f2a07efa158a1bf7fd3e1f7c3c61c38c8810e4 Mon Sep 17 00:00:00 2001 From: Tommaso Sciortino Date: Wed, 27 Aug 2025 12:14:22 -0700 Subject: [PATCH] Fix shell argument parsing in windows (#7160) --- packages/core/src/services/shellExecutionService.test.ts | 2 +- packages/core/src/services/shellExecutionService.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/services/shellExecutionService.test.ts b/packages/core/src/services/shellExecutionService.test.ts index 6c35a32b..9b02995e 100644 --- a/packages/core/src/services/shellExecutionService.test.ts +++ b/packages/core/src/services/shellExecutionService.test.ts @@ -290,7 +290,7 @@ describe('ShellExecutionService', () => { expect(mockPtySpawn).toHaveBeenCalledWith( 'cmd.exe', - ['/c', 'dir "foo bar"'], + '/c dir "foo bar"', expect.any(Object), ); }); diff --git a/packages/core/src/services/shellExecutionService.ts b/packages/core/src/services/shellExecutionService.ts index 41c22d0e..e42cc9bc 100644 --- a/packages/core/src/services/shellExecutionService.ts +++ b/packages/core/src/services/shellExecutionService.ts @@ -141,6 +141,7 @@ export class ShellExecutionService { const child = cpSpawn(commandToExecute, [], { cwd, stdio: ['ignore', 'pipe', 'pipe'], + windowsVerbatimArguments: true, shell: isWindows ? true : 'bash', detached: !isWindows, env: { @@ -322,7 +323,7 @@ export class ShellExecutionService { const isWindows = os.platform() === 'win32'; const shell = isWindows ? 'cmd.exe' : 'bash'; const args = isWindows - ? ['/c', commandToExecute] + ? `/c ${commandToExecute}` : ['-c', commandToExecute]; const ptyProcess = ptyInfo?.module.spawn(shell, args, {