1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-11-29 05:57:07 +02:00

core: polish the core of ripgrep

This I believe finishes are quest to do mechanical updates to ripgrep's
style, bringing it in line with my current practice (loosely speaking).
This commit is contained in:
Andrew Gallant
2023-09-28 16:24:40 -04:00
parent 90b849912f
commit 392bb0944a
7 changed files with 108 additions and 109 deletions

View File

@@ -1,20 +1,24 @@
use std::fs::File;
use std::io;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::time::Duration;
use std::{
io,
path::{Path, PathBuf},
time::Duration,
};
use {
grep::{
cli,
matcher::Matcher,
printer::{Standard, Stats, Summary, JSON},
regex::RegexMatcher as RustRegexMatcher,
searcher::{BinaryDetection, Searcher},
},
ignore::overrides::Override,
serde_json::{self as json, json},
termcolor::WriteColor,
};
use grep::cli;
use grep::matcher::Matcher;
#[cfg(feature = "pcre2")]
use grep::pcre2::RegexMatcher as PCRE2RegexMatcher;
use grep::printer::{Standard, Stats, Summary, JSON};
use grep::regex::RegexMatcher as RustRegexMatcher;
use grep::searcher::{BinaryDetection, Searcher};
use ignore::overrides::Override;
use serde_json as json;
use serde_json::json;
use termcolor::WriteColor;
use crate::subject::Subject;
@@ -396,8 +400,9 @@ impl<W: WriteColor> SearchWorker<W> {
path: &Path,
) -> io::Result<SearchResult> {
let bin = self.config.preprocessor.as_ref().unwrap();
let mut cmd = Command::new(bin);
cmd.arg(path).stdin(Stdio::from(File::open(path)?));
let mut cmd = std::process::Command::new(bin);
cmd.arg(path)
.stdin(std::process::Stdio::from(std::fs::File::open(path)?));
let mut rdr = self.command_builder.build(&mut cmd).map_err(|err| {
io::Error::new(