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

Check that ruptime is present before calling #390

Merged
merged 1 commit into from
Feb 24, 2020

Conversation

Self-Perfection
Copy link
Contributor

Avoids calling command_not_found_handle which might take considerable
time.


For instance on my system command_not_found_handle takes more than 200ms. I don't want this delay every time I complete hostname!

Avoids calling command_not_found_handle which might take considerable
time.
@scop
Copy link
Owner

scop commented Feb 23, 2020

We do this a lot, and I'd rather not start changing all of them or bits here and there. I wonder if there's a clean and robust way we could disable command_not_found_handle for the duration of running completions instead, for example in _init_completion.

Actually this might be something to suggest upstream bash do by default.

@Self-Perfection
Copy link
Contributor Author

When I was preparing change I noticed 10 lines above avahi-browse is tested for presence so I just went with the flow.

It might be possible to save command_not_found_handle state in the beginning, unset this function and restore after completion just like described here: https://mharrison.org/post/bashfunctionoverride/

Don't sure how safe and robust it is.

@scop
Copy link
Owner

scop commented Feb 24, 2020

Ok, fair enough re avahi-browse. A centralized approach would still be preferred, as just calling stuff is what we do pretty much everywhere else in the codebase, and FWIW I'd rather keep it that way. The linked solution irks me though, and I'm not sure if we have a place to cleanly restore the original function.

@scop scop merged commit 6217345 into scop:master Feb 24, 2020
akinomyoga added a commit to akinomyoga/bash-completion that referenced this pull request Jul 8, 2022
When either one of the commands "cc", "c++", "f77", and "f95" is not
found in the system, on the first load of "gcc" completions,
"command_not_found_handle" hook (typically set by distributions) is
invoked in the middle of completion, breaks the terminal layout by
outputting messages, and eats user inputs.  This commit fixes the
issue by checking the existence of commands before running these
commands.

Refs.
akinomyoga/ble.sh#203
akinomyoga/ble.sh#192
scop#390
akinomyoga added a commit to akinomyoga/bash-completion that referenced this pull request Jul 8, 2022
When at least one of the commands "cc", "c++", "f77", and "f95" is not
found in the system, on the first load of "gcc" completions,
"command_not_found_handle" hook (typically set by distributions) is
invoked in the middle of completion, breaks the terminal layout by
outputting messages, and eats user inputs.  This commit fixes the
issue by checking the existence of commands before running these
commands.

Refs.
scop#390
akinomyoga/ble.sh#192
akinomyoga/ble.sh#203
akinomyoga added a commit to akinomyoga/bash-completion that referenced this pull request Jul 10, 2022
When at least one of the commands "cc", "c++", "f77", and "f95" is not
found in the system, on the first load of "gcc" completions,
"command_not_found_handle" hook (typically set by distributions) is
invoked in the middle of completion, breaks the terminal layout by
outputting messages, and eats user inputs.  This commit fixes the
issue by checking the existence of commands before running these
commands.

Refs.
scop#390
akinomyoga/ble.sh#192
akinomyoga/ble.sh#203
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.

2 participants