anthropics / anthropics/claude-code

Generated commands don't match the user's known OS/shell (Bash emitted for Windows/PowerShell)

Offen
#88,572 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area:bash area:model bug platform:vscode platform:windows
Vorherrschende Sprache
Python
Sterne
145k
Forks
23.1k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

**Environment:** Claude Code (VSCode extension), Windows 11 / PowerShell — the standing, stated environment, known to the assistant before it generated the commands.

**Problem:** Claude Code repeatedly generated commands for the wrong shell/OS despite the known Windows/PowerShell context, forcing the user to correct or debug them.

**Concrete instances in a single session:**
- **Bash syntax emitted for PowerShell:** `VAR=value` assignments and `$(...)` command substitution — both are parse errors in PowerShell (`The term 'VAR=value' is not recognized as the name of a cmdlet…`).
- **Fragile command wrapping:** wrapping a client CLI in `sh -c '…'` produced mangled/blank output through PowerShell, where the direct form worked cleanly.
- **Windows path not handled:** `kubectl cp` given a Windows absolute source path (`C:\Users\…`) fails because the drive-letter colon is parsed as the `pod:path` separator (`error: one of src or dest must be a local file specification`); a relative, colon-free source path is required. This is a well-known Windows `kubectl cp` gotcha that was not accounted for.
- **Trailing inline `#` comments** on command lines (with a `→` arrow) bled into command output through the paste flow, corrupting a query result.

**Expected:** Generated commands should default to the session's known OS/shell (PowerShell syntax here) and account for documented Windows-specific tooling quirks (e.g. the `kubectl cp` drive-colon).

**Impact:** Repeated corrections and lost time on an otherwise routine operational task; the OS/shell was known in advance, so the mismatches were avoidable.

**Suggested fix:** Bind generated commands to the session's known OS/shell; when a value, path, or quoting form is OS-sensitive, emit the form valid for that OS, and keep command blocks free of non-executable decoration.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

The issue names no files, tests, or entry points; start by locating command generation and any shell/OS-aware output tests. Done means generated commands honor the known Windows/PowerShell context, avoid non-executable inline decoration, and handle the stated kubectl cp path case.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
kubernetes, powershell
Bereich
cli, operating-systems
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.