summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-11-24 12:14:35 -0500
committerDan Davison <dandavison7@gmail.com>2021-11-24 13:06:38 -0500
commit8ff50afccb1d065b105db83eda19341c3458f964 (patch)
tree8ff8c0f6dad70953f6b3c1ad4fcb449913eb3cf5
parent7eb4928018fdf5d9208f2c6ac9bfca59f3331114 (diff)
Do not recognize grep tools whose output we cannot currently parse
Ref #794
-rw-r--r--src/utils/process.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/utils/process.rs b/src/utils/process.rs
index ee145f88..124defa7 100644
--- a/src/utils/process.rs
+++ b/src/utils/process.rs
@@ -102,8 +102,11 @@ pub fn describe_calling_process(args: &[String]) -> ProcessArgs<CallingProcess>
}
}
Some(s) => match s.to_str() {
- Some("rg") | Some("grep") | Some("ack") | Some("ag") | Some("pt")
- | Some("sift") | Some("ucg") => ProcessArgs::Args(CallingProcess::OtherGrep),
+ // TODO: parse_style_sections is failing to parse ANSI escape sequences emitted by
+ // grep (BSD and GNU), ag, pt. See #794
+ Some("rg") | Some("ack") | Some("sift") => {
+ ProcessArgs::Args(CallingProcess::OtherGrep)
+ }
_ => {
// It's not git, and it's not another grep tool. Keep
// looking at other processes.
@@ -686,15 +689,15 @@ pub mod tests {
Some(CallingProcess::GitGrep(([].into(), [].into())))
);
- for other_grep_command in &[
+ for grep_command in &[
"/usr/local/bin/rg pattern hello.txt",
- "grep pattern hello.txt",
- "/usr/bin/grep pattern hello.txt",
+ "rg pattern hello.txt",
+ "/usr/local/bin/ack pattern hello.txt",
"ack.exe pattern hello.txt",
] {
let parent = MockProcInfo::with(&[
(2, 100, "-shell", None),
- (3, 100, other_grep_command, Some(2)),
+ (3, 100, grep_command, Some(2)),
(4, 100, "delta", Some(3)),
]);
assert_eq!(