anthropics / anthropics/claude-code

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

Open
#88,572 0 comments 0 reactions 0 assignees View on GitHub
area:bash area:model bug platform:vscode platform:windows
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

**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.

Contributor guide

No contributing guide indexed for this repository

Research direction

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.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, powershell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.