Background tasks don't stream output (--print mode buffers until completion)
Resolved 💬 2 comments Opened Dec 3, 2025 by EivMeyer Closed Dec 3, 2025
Problem
When running background tasks via claude --print, output is buffered until the task completes. This makes it impossible to monitor long-running tasks in real-time.
Current Behavior
# Spawn background task
ct_run "Run E2E tests and fix failures"
# Check logs immediately - only see header
ct_logs task-xxx
# Output: Just the initial header, no streaming content
# Process tree shows active work (Playwright running)
pstree -p 761026
# Shows: claude -> npm exec @playwright -> node workers
# But logs don't update until task completes
Expected Behavior
Output should stream to the log file in real-time, allowing:
- Monitoring progress of long-running tasks
- Early detection of issues
- Understanding what the agent is currently doing
Reproduction
- Start a background task:
claude --print "Run all E2E tests" - Monitor the log file:
tail -f ~/.claude-tasks/logs/task-xxx.log - Observe: No output streams until task completes
Environment
- Claude Code CLI
- Running via MCP server that spawns
claude --printwith detached stdio
Suggested Fix
Add a --stream flag or make --print stream by default when stdout is a pipe/file rather than TTY.
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗