You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: decouple output_to_file from gemini_debug
Check output_to_file first, independently of debug mode. The debug flag
only controls whether --debug is passed to gemini CLI. Also extract
command args to avoid duplicating the gemini invocation.
Ref: #479
# Run Gemini CLI with the provided prompt, using JSON output format
315
321
# We capture stdout (JSON) to TEMP_STDOUT and stderr to TEMP_STDERR
316
-
if [[ "${GEMINI_DEBUG}" = true ]] && [[ "${OUTPUT_TO_FILE}" = true ]]; then
317
-
echo "::notice::Gemini CLI debug output redirected to files (gemini-artifacts/)"
318
-
if ! gemini --debug --yolo --prompt "${PROMPT}" --output-format json 2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"; then
322
+
if [[ "${OUTPUT_TO_FILE}" = true ]]; then
323
+
echo "::notice::Gemini CLI output redirected to files (gemini-artifacts/)"
324
+
if ! gemini ${GEMINI_ARGS} 2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"; then
319
325
FAILED=true
320
326
fi
321
327
elif [[ "${GEMINI_DEBUG}" = true ]]; then
322
328
echo "::warning::Gemini CLI debug logging is enabled. This will stream responses, which could reveal sensitive information if processed with untrusted inputs."
323
329
echo "::: Start Gemini CLI STDOUT :::"
324
-
if ! gemini --debug --yolo --prompt "${PROMPT}" --output-format json 2> >(tee "${TEMP_STDERR}" >&2) | tee "${TEMP_STDOUT}"; then
330
+
if ! gemini ${GEMINI_ARGS} 2> >(tee "${TEMP_STDERR}" >&2) | tee "${TEMP_STDOUT}"; then
325
331
FAILED=true
326
332
fi
327
333
# Wait for async stderr logging to complete. This is because process substitution in Bash is async so let tee finish writing to ${TEMP_STDERR}
328
334
sleep 1
329
335
echo "::: End Gemini CLI STDOUT :::"
330
336
else
331
-
if ! gemini --yolo --prompt "${PROMPT}" --output-format json 2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"; then
337
+
if ! gemini ${GEMINI_ARGS} 2> "${TEMP_STDERR}" 1> "${TEMP_STDOUT}"; then
0 commit comments