Skip to content

Conversation

@AstroAir
Copy link

This pull request improves the safety and reliability of command-line argument handling for both Windows and WSL environments in the src/extension.ts file. The main focus is on escaping arguments to prevent issues with spaces and special characters when spawning processes or sending commands to terminals. Two utility functions are introduced for escaping arguments in Windows (escapeShellArg) and bash/WSL (escapeBashArg), and these are now used throughout the code wherever commands are constructed.

Argument escaping and process spawning:

  • Added escapeShellArg and escapeBashArg utility functions to safely handle command-line arguments for Windows and bash/WSL shells, preventing errors due to spaces or special characters.
  • Updated WSL process spawning logic to use escapeBashArg for all relevant arguments, ensuring commands are correctly quoted and parsed in bash.
  • Updated native Windows process spawning logic to use escapeShellArg for arguments when shell: true is set, improving compatibility and correctness.

Terminal command construction:

  • Modified WSL terminal commands for login, model selection, and other commands to use escapeBashArg for paths and arguments, ensuring robust handling of spaces and special characters. [1] [2] [3]

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