fix(windows): use proper argument splatting for Claude CLI execution

The previous approach using:
  & claude $ClaudeArgs

was not properly expanding the array, causing Claude CLI to see:
  error: unknown option '--settings C:\Users\kaidu\.ccs\sonnet.settings.json'

Fixed by using direct splatting:
  & claude --settings $SettingsPath @RemainingArgs

This ensures proper argument quoting and separation, matching bash behavior:
  exec claude --settings "$SETTINGS_PATH" "$@"
This commit is contained in:
kaitranntt
2025-11-02 02:39:02 -05:00
parent ddf1b170b5
commit 2b03406f00
+4 -6
View File
@@ -84,12 +84,10 @@ if (-not (Test-Path $SettingsPath)) {
}
# Execute claude with settings
# Build argument array to pass all remaining arguments to Claude CLI
$ClaudeArgs = @("--settings", $SettingsPath)
# Pass arguments directly to Claude CLI with proper splatting
if ($RemainingArgs) {
$ClaudeArgs += $RemainingArgs
& claude --settings $SettingsPath @RemainingArgs
} else {
& claude --settings $SettingsPath
}
# Execute claude and preserve exit code
& claude $ClaudeArgs
exit $LASTEXITCODE