Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix airflow db shell needing an extra keypress to exit #35982

Merged

Conversation

renzepost
Copy link
Contributor

@renzepost renzepost commented Nov 30, 2023

Related: #26186
As @blag noted in #26186, pressing Ctrl-D (EOF) to exit the interactive shell requires an additional keypress to actually exit.
It seems that select.select() was blocking, and setting the timeout parameter to 0 fixes the issue of the interactive shell not exiting immediately after pressing Ctrl-D (or typing \q + Enter in psql). The docs for select state:

When the timeout argument is omitted the function blocks until at least one file descriptor is ready. A time-out value of zero specifies a poll and never blocks.

I tested the fix with all the supported db backends and saw no adverse effects, but hopefully someone with more experience with select can tell if this is a reasonable approach.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@renzepost renzepost changed the title Fix airflow db shell needing an extra keypress to exit Fix airflow db shell needing an extra keypress to exit Nov 30, 2023
@potiuk potiuk merged commit cbb9c4f into apache:main Nov 30, 2023
47 checks passed
@potiuk
Copy link
Member

potiuk commented Nov 30, 2023

Fantastic! Thanks @renzepost !

@renzepost renzepost deleted the fix_execute_interactive_extra_keypress_after_eof branch November 30, 2023 20:32
@ephraimbuddy ephraimbuddy added this to the Airflow 2.8.0 milestone Dec 5, 2023
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Dec 5, 2023
ephraimbuddy pushed a commit that referenced this pull request Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants