Skip to main content

claude-print-subprocess-error-streams

Fix for opaque `RuntimeError: Claude session failed: ` (or any wrapper-error with empty content) when wrapping `claude --print --output-format json` in Python subprocess. Use when: (1) you wrap `claude --print` (or any `claude` non-interactive CLI invocation) via `subprocess.run` / `subprocess.communicate` to drive batch automation; (2) the subprocess exits with non-zero returncode but `result.stderr` is empty so your error message is empty; (3) you suspect an error happened inside the Claude session but can't see it. Root cause: `claude --print --output-format json` writes its session result — including errors as `{"is_error": true, ...}` JSON — to STDOUT, not STDERR. Wrappers that surface only `result.stderr` lose the actual error. The fix is to surface BOTH streams in the wrapper's RuntimeError, with `result.stdout` taking the larger budget since errors are JSON there.

설치로 이동

소스 정보

저장소
cajias/claude-skills
최근 소스 활동
2026년 7월 20일 07:29
감지된 SKILL.md 언어
영어
스타
0
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.