[BUG] StatusLine not rendering in Windows Terminal despite successful script execution
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?
Environment
- OS: Windows 11 (Build 22631)
- Claude Code version: Latest (2.0.70 (Claude Code))
- Terminals tested:
- Git Bash standalone - WORKS
- VS Code integrated terminal (bash) - WORKS
- Windows Terminal with Git Bash profile - DOES NOT WORK
- Windows Terminal with PowerShell profile - DOES NOT WORK
- TERM:
xterm-256color
Description
StatusLine commands execute successfully but output is never rendered when Claude Code runs inside Windows Terminal. The same configuration works perfectly in Git Bash standalone and VS Code's integrated terminal.
Configuration
~/.claude/settings.json:
{
"statusLine": {
"type": "command",
"command": "powershell -NoProfile -ExecutionPolicy Bypass -File ~/.claude/statusline.ps1"
}
}
~/.claude/statusline.ps1:
$e = [char]27
$j = $input | ConvertFrom-Json
$m = $j.model.display_name
$d = Split-Path $j.cwd -Leaf
$cu = $j.context_window.current_usage
$used = $cu.input_tokens + $cu.output_tokens + $cu.cache_creation_input_tokens + $cu.cache_read_input_tokens
$total = $j.context_window.context_window_size
$pct = [math]::Round(100 - ($used / $total * 100))
# Git info
$git = ''
try {
$b = git -C $j.cwd branch --show-current 2>$null
if ($b) {
$dirty = ''
$status = git -C $j.cwd status --porcelain 2>$null
if ($status) { $dirty = '*' }
$git = " ($b$dirty)"
}
} catch {}
# Color based on percentage
$c = if ($pct -gt 50) { '32' } elseif ($pct -gt 30) { '33' } else { '31' }
$usedK = [math]::Round($used/1000)
$totalK = [math]::Round($total/1000)
[Console]::WriteLine("$e[35m$m$e[0m | $e[33m$d$e[36m$git$e[0m | $e[$c`m$pct% (${usedK}k/${totalK}k)$e[0m")
What Should Happen?
Expected behavior
StatusLine should display in Windows Terminal the same as it does in Git Bash standalone and VS Code integrated terminal.
Error Messages/Logs
2025-12-16 00:34:06 - Script started from: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
2025-12-16 00:34:06 - JSON parsed successfully
2025-12-16 00:34:06 - Output: Opus 4.5 | MyProject | 100% (0k/200k)
2025-12-16 00:34:10 - Script started from: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
2025-12-16 00:34:10 - JSON parsed successfully
2025-12-16 00:34:10 - Output: Opus 4.5 | MyProject | 57% (86k/200k)
Steps to Reproduce
- Configure ~/.claude/settings.json with statusLine command (see Configuration)
- Create ~/.claude/statusline.ps1 script (see Configuration)
- Open Windows Terminal (Git Bash or PowerShell profile)
- Run
claude - Send any message
- Observe: no statusline appears despite script executing successfully (proven by logs)
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.70 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Proof that script executes successfully
Added debug logging to the script:
$logFile = "$env:USERPROFILE\.claude\statusline.log"
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content $logFile "$timestamp - Script started from: $((Get-Process -Id $PID).Path)"
# ... after generating output ...
Add-Content $logFile "$timestamp - Output: $output"
Log output (from Windows Terminal session where statusline did NOT display):
2025-12-16 00:34:06 - Script started from: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
2025-12-16 00:34:06 - JSON parsed successfully
2025-12-16 00:34:06 - Output: Opus 4.5 | MyProject | 100% (0k/200k)
2025-12-16 00:34:10 - Script started from: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
2025-12-16 00:34:10 - JSON parsed successfully
2025-12-16 00:34:10 - Output: Opus 4.5 | MyProject | 57% (86k/200k)
What we tested
| Approach | Result |
|----------|--------|
| echo 'test' (simple cmd) | Works in Git Bash/VS Code, not in Windows Terminal |
| echo %USERNAME% (cmd variable) | Shows username - confirms cmd.exe context |
| powershell -Command "Write-Host 'test'" | Works in Git Bash/VS Code, not in Windows Terminal |
| PowerShell script with Write-Host | Script runs, no output in Windows Terminal |
| PowerShell script with stdout string | Script runs, no output in Windows Terminal |
| PowerShell script with [Console]::WriteLine() | Script runs, no output in Windows Terminal |
| $env:TERM | Already set to xterm-256color |
Root cause
Claude Code executes the statusline command via PowerShell correctly in all terminals (confirmed by logging). However, Claude Code fails to capture/render the output when running inside Windows Terminal, while it works in Git Bash standalone and VS Code integrated terminal.
This suggests the issue is in how Claude Code captures stdout from child processes when running inside Windows Terminal.
Related issues
- #5863 - macOS issue, closed due to inactivity (different platform, not applicable to Windows)
- #6526 - Closed incorrectly as duplicate of #5863
Neither issue addressed the Windows Terminal-specific problem.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗