環境変数

CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS

-pフラグを使用した非対話型モードにおいて、出力の一部となるバックグラウンドのサブエージェントやワークフローの完了を待機する最大時間をミリ秒単位で設定します。

使い方・用途

  • バックグラウンドで動作するサブエージェントが停止した場合に、プロセスがいつまでも終了しない問題を回避するために使用します。
  • デフォルトの10分制限を超えて処理を継続させたい場合や、逆にタイムアウトを短縮してCI/CDパイプラインの回転を速めたい場合に調整します。
  • 0に設定することで、バックグラウンドタスクが完了するまで無期限に待機させることが可能です。
英語原文(公式ドキュメントより)

Maximum time in milliseconds that non-interactive mode with the -p flag waits after the final turn for background subagents and workflows whose result is part of the output. Default: 600000, or 10 minutes. When the cap is exceeded, remaining background tasks are terminated and the process exits. Set to 0 to wait indefinitely. This cap is separate from the five-second grace period that applies to plain background shells