Bash commands with pipes or 'cd && ...' pattern run in background with empty output
Resolved 💬 3 comments Opened Jan 6, 2026 by talatiamops Closed Feb 19, 2026
Description
Certain bash command patterns are automatically being run in background mode and produce empty output files, causing Claude Code to get stuck.
Commands that fail (run in background with 0 bytes output)
cd /path/to/repo && git diff --stat package.json
git diff package.json | head -20
Commands that work correctly
git -C /path/to/repo diff --name-only
git --version
echo "test"
Observed behavior
- Commands with pipes (
|) orcd ... &&patterns trigger automatic background execution - The output file is created but remains empty (0 bytes)
- Claude gets stuck waiting for output that never comes
Example from logs:
Bash(cd /Users/<user>/Documents/github/<reponame>i && git diff --stat package.json)
⎿ Running in the background (↓ to manage)
ls -la /tmp/claude/<user>/tasks/b8ab45e.output && wc -l
⎿ -rw-r--r--@ 1 tal.green wheel 0 6 ינו׳ 11:57 ...
0 /tmp/claude/<user>/tasks/b8ab45e.output
Environment
- Platform: macOS Darwin 25.2.0
- Git version: 2.46.0
Workaround
Using git -C /path syntax instead of cd /path && git works correctly.
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗