mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-11-23 21:54:45 +02:00
committed by
GitHub
parent
bb8172fe9b
commit
a7b7d81d66
@@ -177,7 +177,7 @@ impl DecompressionMatcher {
|
|||||||
/// If there are multiple possible commands matching the given path, then
|
/// If there are multiple possible commands matching the given path, then
|
||||||
/// the command added last takes precedence.
|
/// the command added last takes precedence.
|
||||||
pub fn command<P: AsRef<Path>>(&self, path: P) -> Option<Command> {
|
pub fn command<P: AsRef<Path>>(&self, path: P) -> Option<Command> {
|
||||||
for i in self.globs.matches(path).into_iter().rev() {
|
if let Some(i) = self.globs.matches(path).into_iter().next_back() {
|
||||||
let decomp_cmd = &self.commands[i];
|
let decomp_cmd = &self.commands[i];
|
||||||
let mut cmd = Command::new(&decomp_cmd.bin);
|
let mut cmd = Command::new(&decomp_cmd.bin);
|
||||||
cmd.args(&decomp_cmd.args);
|
cmd.args(&decomp_cmd.args);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ fn main() {
|
|||||||
let stdout_thread = std::thread::spawn(move || {
|
let stdout_thread = std::thread::spawn(move || {
|
||||||
let mut stdout = std::io::BufWriter::new(std::io::stdout());
|
let mut stdout = std::io::BufWriter::new(std::io::stdout());
|
||||||
for dent in rx {
|
for dent in rx {
|
||||||
stdout.write(&*Vec::from_path_lossy(dent.path())).unwrap();
|
stdout.write_all(&Vec::from_path_lossy(dent.path())).unwrap();
|
||||||
stdout.write(b"\n").unwrap();
|
stdout.write_all(b"\n").unwrap();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -571,7 +571,7 @@ impl<W: io::Write> JSON<W> {
|
|||||||
} else {
|
} else {
|
||||||
json::to_writer(&mut self.wtr, message)?;
|
json::to_writer(&mut self.wtr, message)?;
|
||||||
}
|
}
|
||||||
self.wtr.write(&[b'\n'])?;
|
let _ = self.wtr.write(b"\n")?; // This will always be Ok(1) when successful.
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ impl<'a> Data<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
fn from_path(path: &Path) -> Data {
|
fn from_path(path: &Path) -> Data<'_> {
|
||||||
// Using lossy conversion means some paths won't round trip precisely,
|
// Using lossy conversion means some paths won't round trip precisely,
|
||||||
// but it's not clear what we should actually do. Serde rejects
|
// but it's not clear what we should actually do. Serde rejects
|
||||||
// non-UTF-8 paths, and OsStr's are serialized as a sequence of UTF-16
|
// non-UTF-8 paths, and OsStr's are serialized as a sequence of UTF-16
|
||||||
|
|||||||
Reference in New Issue
Block a user