[BUG] Claude Status line output truncated on Windows - only shows branch name, missing git status info
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Using claude code
Claude's status line has been configured to show git status info, same setup has worked reliably on claude in Linux environment, so should display: (dev *2 ?2)
but shows only(dev)
The custom status line script output has been verified as outputting the full status information as expected, but this doesn't make it to the status line. bash .claude/statusline.sh
[33m(dev *2 ?2)[0m
Restarting Claude makes no difference.
What Should Happen?
Claude's status line has been configured to show git status info, this has worked reliably on claude in Linux environment, so should display (branch + modified + untracked counts): (dev *2 ?2)
in yellow/amber colour
Error Messages/Logs
N/A
Steps to Reproduce
1. inside a folder with a git repo
2. use this statusline.sh
#!/bin/bash
# Claude Code status line script - shows git branch and compact status
# Read JSON input (contains cwd, etc.)
read -r input
# Extract working directory from JSON
cwd=$(echo "$input" | sed -n 's/.*"cwd":"\([^"]*\)".*/\1/p')
# Default to current directory if not provided
if [ -z "$cwd" ]; then
cwd="."
fi
cd "$cwd" 2>/dev/null || exit 0
# Check if in a git repo
if [ ! -d ".git" ] && ! git rev-parse --git-dir > /dev/null 2>&1; then
printf "$(basename "$cwd")"
exit 0
fi
# Get git branch
branch=$(git --no-optional-locks branch --show-current 2>/dev/null)
if [ -z "$branch" ]; then
branch=$(git --no-optional-locks rev-parse --short HEAD 2>/dev/null || echo "unknown")
fi
# Count file changes
modified=$(git --no-optional-locks diff --name-only 2>/dev/null | wc -l | tr -d ' ')
staged=$(git --no-optional-locks diff --cached --name-only 2>/dev/null | wc -l | tr -d ' ')
untracked=$(git --no-optional-locks ls-files --others --exclude-standard 2>/dev/null | wc -l | tr -d ' ')
# Check commits ahead/behind remote
upstream_branch=$(git --no-optional-locks rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null)
if [ -n "$upstream_branch" ]; then
ahead=$(git --no-optional-locks rev-list --count @{u}..HEAD 2>/dev/null || echo "0")
behind=$(git --no-optional-locks rev-list --count HEAD..@{u} 2>/dev/null || echo "0")
else
ahead="0"
behind="0"
fi
# Build git info parts with spaces
git_parts="$branch"
# Add ahead/behind info
if [ "$ahead" -gt 0 ] && [ "$behind" -gt 0 ]; then
git_parts="$git_parts ↑$ahead↓$behind"
elif [ "$ahead" -gt 0 ]; then
git_parts="$git_parts ↑$ahead"
elif [ "$behind" -gt 0 ]; then
git_parts="$git_parts ↓$behind"
fi
# Add file status
[ "$staged" -gt 0 ] && git_parts="$git_parts +$staged"
[ "$modified" -gt 0 ] && git_parts="$git_parts *$modified"
[ "$untracked" -gt 0 ] && git_parts="$git_parts ?$untracked"
# Output with parentheses grouping everything together
printf "\033[33m(%s)\033[0m" "$git_parts"
3. use this .claude/settings.local.json
{
"statusLine": {
"type": "command",
"command": "\"C:\\Program Files\\Git\\usr\\bin\\bash.exe\" .claude/statusline.sh"
}
}
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.56
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Environment:
- OS: Windows 11
- Git Bash: C:\Program Files\Git\usr\bin\bash.exe
- Works correctly: Linux terminal (up to date linux mint, using Tilix as terminal)
- Fails: Windows Terminal, VSCode terminal
This appears to be a Windows-specific issue with how Claude Code captures or renders the output from the statusline command.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗