ripGrep function
Execute ripgrep with the given arguments and target directory/file. Returns a list of matching lines.
Handles:
- EAGAIN retry with single-threaded mode
- Timeout with partial results
- Buffer overflow with partial results
- Critical errors (ENOENT, EACCES, EPERM)
Implementation
Future<List<String>> ripGrep(
List<String> args,
String target, {
Duration? timeout,
}) async {
await _codesignRipgrepIfNecessary();
// Test ripgrep on first use and cache the result (fire and forget).
_testRipgrepOnFirstUse().catchError((_) {});
return _ripGrepWithRetry(args, target, timeout: timeout, isRetry: false);
}