diff --git a/packages/core/src/utils/shell-utils.test.ts b/packages/core/src/utils/shell-utils.test.ts index e87c90b..77e60e3 100644 --- a/packages/core/src/utils/shell-utils.test.ts +++ b/packages/core/src/utils/shell-utils.test.ts @@ -320,7 +320,7 @@ describe('escapeShellArg', () => { it('should handle empty strings', () => { const result = escapeShellArg('', 'bash'); - expect(result).toBe(''); + expect(result).toBe("''"); expect(mockQuote).not.toHaveBeenCalled(); }); }); @@ -339,7 +339,7 @@ describe('escapeShellArg', () => { it('should handle empty strings', () => { const result = escapeShellArg('', 'cmd'); - expect(result).toBe(''); + expect(result).toBe('""'); }); }); @@ -361,7 +361,7 @@ describe('escapeShellArg', () => { it('should handle empty strings', () => { const result = escapeShellArg('', 'powershell'); - expect(result).toBe(''); + expect(result).toBe("''"); }); }); }); diff --git a/packages/core/src/utils/shell-utils.ts b/packages/core/src/utils/shell-utils.ts index e0e62ec..91dbc48 100644 --- a/packages/core/src/utils/shell-utils.ts +++ b/packages/core/src/utils/shell-utils.ts @@ -89,8 +89,8 @@ export const isWindows = () => os.platform() === 'win32'; * @returns The shell-escaped string. */ export function escapeShellArg(arg: string, shell: ShellType): string { - if (!arg) { - return ''; + if (arg === '') { + return shell === 'cmd' ? '""' : "''"; } switch (shell) {