From 8ff50afccb1d065b105db83eda19341c3458f964 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Wed, 24 Nov 2021 12:14:35 -0500 Subject: Do not recognize grep tools whose output we cannot currently parse Ref #794 --- src/utils/process.rs | 15 +++++++++------ 1 file 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 } } 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!( -- cgit v1.2.3