From b39f4a2a4b705dccf7953b355029ddd0e96cfc0a Mon Sep 17 00:00:00 2001 From: Fahad <155962781+Fahad-Dezloper@users.noreply.github.com> Date: Tue, 24 Jun 2025 00:20:48 +0530 Subject: [PATCH] Nizzy sync utils.ts updated for windows (#1316) --- packages/cli/src/utils.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/utils.ts b/packages/cli/src/utils.ts index 0d313a87b..0da70378e 100644 --- a/packages/cli/src/utils.ts +++ b/packages/cli/src/utils.ts @@ -16,10 +16,21 @@ export const getProjectRoot = async () => { }; export const runCommand = async (command: string, args: string[], options: SpawnOptions = {}) => { - const child = spawn(command, args, { stdio: 'inherit', ...options }); - await new Promise((resolve, reject) => { - child.once('close', resolve); - child.once('error', reject); + const useShell = process.platform === 'win32'; + const finalCommand = command; + const finalArgs = args; + + const spawnOptions: SpawnOptions = { + stdio: 'inherit', + ...options, + ...(useShell && options.shell === undefined ? { shell: true } : {}) + }; + + const child = spawn(finalCommand, finalArgs, spawnOptions); + + await new Promise((resolve, reject) => { + child.once('close', () => resolve()); + child.once('error', (err) => reject(err)); }); };