Skip to content

Conversation

@akramcodez
Copy link

Description

The escapeShellArg utility previously returned an empty string when the input argument itself was an empty string (""). As a result, empty arguments were completely omitted from the generated command line, causing positional arguments to shift. This could silently break commands that rely on empty string placeholders.

Solution

Updated escapeShellArg in packages/core/src/utils/shell-utils.ts to explicitly handle empty string inputs. The function now returns a quoted empty string instead of yielding nothing:

  • "" for cmd
  • '' for bash / PowerShell

This ensures empty arguments are preserved correctly across all supported shells.

File Changes

  • packages/core/src/utils/shell-utils.ts
    Modified escapeShellArg to return a quoted empty string when the argument is empty.

  • packages/core/src/utils/shell-utils.test.ts
    Updated unit tests to verify that empty strings are correctly escaped and preserved for all supported shells.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant