Guard completion requests against misbehaving callbacks.#108
Open
floitsch wants to merge 2 commits into
Open
Conversation
Shells don't interrupt slow completion commands: a completion callback that hangs (for example on a network operation) blocks the user's prompt until they hit ctrl-c. Give up after 5 seconds and exit with a non-zero code, which the generated completion scripts already treat as 'no completions'. The same guard also silences callbacks that throw, which would otherwise dump a stack trace onto the user's prompt.
Completion candidates are printed to stdout, so any library logging from completion callbacks (for example the file-lock logging of the cache) would corrupt the completion output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completion requests run while the user is waiting for the shell to
react to a tab-press, and shells don't interrupt slow completion
commands: a completion callback that hangs (for example on a network
operation) blocks the user's prompt until they hit ctrl-c.
Bound the time a completion request may take to 5 seconds and exit
with a non-zero code on timeout or exception, which the generated
completion scripts already treat as 'no completions'. This also keeps
a throwing callback from dumping a stack trace onto the user's prompt.
Additionally, silence the default logger while handling a completion
request: candidates are printed to stdout, so any library logging from
a completion callback (for example the file-lock logging of the cache)
would corrupt the completion output.