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 に表示されている付属ファイルをお読みください。