Skip to content

fix(helper): avoid unhandled EOFError in build_image when running non-interactively - #15971

Open
alifakbxr wants to merge 1 commit into
google:masterfrom
alifakbxr:fix/15970-helper-eof-error
Open

fix(helper): avoid unhandled EOFError in build_image when running non-interactively#15971
alifakbxr wants to merge 1 commit into
google:masterfrom
alifakbxr:fix/15970-helper-eof-error

Conversation

@alifakbxr

Copy link
Copy Markdown

Fixes #15970

Issue:
When executing python3 infra/helper.py build_image <project> without specifying either the --pull or --no-pull arguments, the script prompts the user for a pull decision using raw_input. If this command is run in a non-interactive environment (e.g. CI/CD or with standard input closed/redirected to /dev/null), raw_input throws an unhandled EOFError, exposing a confusing Python traceback and causing the automation to fail unpredictably.

Fix:
This PR catches the EOFError exception raised by raw_input during the prompt. Instead of emitting a traceback, it cleanly catches the exception, logs a concise error message (No input available. Please specify --pull or --no-pull when running non-interactively.), and safely exits the image build process with a failed status. This gives automated callers a stable CLI diagnostic and clearly communicates how to resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(helper): avoid an unhandled EOFError when build_image has no stdin

1 participant