[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.
Root Cause Identified
The truncation issue was actually caused by Git Bash fork errors on Windows.
The error message in the Claude Code statusline was, after many many minutes
0 [main] bash 1681 C:\Program Files\Git\usr\bin\bash.exe: *** fatal error in forked process - WFSO timed out after longjmp
This might be a known MSYS2/Git Bash issue on Windows where fork operations intermittently fail due to Windows security features or antivirus interference.
Workaround was switch to PowerShell and native PowerShell script
Original config (.claude/settings.local.json):
{
"statusLine": {
"type": "command",
"command": "\"C:\\Program Files\\Git\\usr\\bin\\bash.exe\" .claude/statusline.sh"
}
}
Working config:
{
"statusLine": {
"type": "command",
"command": "powershell -NoProfile -ExecutionPolicy Bypass -File .claude/statusline.ps1"
}
}
This works reliably on Windows Terminal and VSCode terminal.
Can confirm this worked for me on v2.0.76 as well.
My Setup
- Windows 11
- Claude Code v2.0.76
- Windows Terminal (running
claudefrom CMD) - Git Bash installed
What I Experienced
The statusline would either:
- Not show up at all
- Appear briefly during processing and immediately disappear
- Execute successfully (confirmed in debug logs) but never render in the UI
Tried everything with bash scripts - different paths, permissions, stdout verification - all worked manually but failed in Claude Code.
Solution That Worked
Switched from Git Bash to PowerShell native script.
.claude/statusline.ps1:
$json = $input | ConvertFrom-Json
$hora = Get-Date -Format "HH:mm:ss"
[Console]::WriteLine("HORA: $hora")
.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "powershell -NoProfile -ExecutionPolicy Bypass -File .claude/statusline.ps1"
}
}
Result: Statusline now shows consistently and persistently in Windows Terminal. No more disappearing, no more fork errors.
Key Takeaway for Windows Users
If your statusline isn't working in Windows Terminal:
- ❌ Don't use Git Bash (fork errors)
- ✅ Use PowerShell with -NoProfile -ExecutionPolicy Bypass
- ✅ Use [Console]::WriteLine() for output
- ✅ Use relative path .claude/statusline.ps1
Thanks for identifying the Git Bash fork issue!
Root Cause Identified
The truncation issue was actually caused by Git Bash fork errors on Windows.
The error message in the Claude Code statusline was, after many many minutes
0 [main] bash 1681 C:\Program Files\Git\usr\bin\bash.exe: *** fatal error in forked process - WFSO timed out after longjmpThis might be a known MSYS2/Git Bash issue on Windows where fork operations intermittently fail due to Windows security features or antivirus interference.
Workaround was switch to PowerShell and native PowerShell script
Original config (.claude/settings.local.json):
{ "statusLine": { "type": "command", "command": "\"C:\\Program Files\\Git\\usr\\bin\\bash.exe\" .claude/statusline.sh" } }Working config:
{ "statusLine": { "type": "command", "command": "powershell -NoProfile -ExecutionPolicy Bypass -File .claude/statusline.ps1" } }This works reliably on Windows Terminal and VSCode terminal.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.