[BUG] claude -p hangs when spawned as subprocess from within CC session (2.1.84)

Resolved 💬 3 comments Opened Mar 26, 2026 by modalmind Closed Mar 30, 2026

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?

claude -p hangs when spawned via subprocess.run() from a Python process that's itself running inside a CC Bash tool. The CC runtime environment seems to be blocking or queuing child claude processes.

What Should Happen?

claude -p returns within seconds (as it does from a standalone terminal)

Error Messages/Logs

Steps to Reproduce

  1. Open Claude Code session
  2. From the CC session, run a Python script that does:

subprocess.run(["claude", "-p", "--output-format", "text"], input="Say hello", capture_output=True, timeout=60)

  1. The subprocess hangs indefinitely — never returns

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.83

Claude Code Version

2.1.84

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗