Skip to content

Canceling a search from the grep crate #2294

Discussion options

You must be logged in to vote

The only way is to send a signal somehow, but I honestly don't know how that would work in practice.

Whether something more deliberate could be added is not entirely clear. Certainly, it simply cannot be done in all cases. For example, a multi-line search requires that the entire file be in memory (whether via memory map or heap), and then let's the regex engine run on it. There is no way, and probably never will be, a way to stop the regex engine once a search has started.

However, a line oriented search could in theory be stopped because it can search the file in segments via buffering. You couldn't interrupt a search on a single buffer, but you could, in theory, implement something to …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@BurntSushi
Comment options

@BurntSushi
Comment options

@chipsenkbeil
Comment options

@chipsenkbeil
Comment options

@BurntSushi
Comment options

Answer selected by chipsenkbeil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants