LiJiefei / codesearch

Automatically exported from code.google.com/p/codesearch
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

csearch/cgrep exit with status 1 regardless of matches found or not #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. csearch int
2. echo $?
3. csearch SomeStringNotAppearingInYourSourceTree
4. echo $?

What is the expected output? What do you see instead?
In both cases, a '1' is displayed indicating that csearch believes it found no 
matches.  This is because the Grep.Match field is not updated when a match is 
found.

What version of the product are you using? On what operating system?
tip, darwin

Please provide any additional information below.
A one line fix setting g.Match = true in match.go:Grep.Reader():430 should fix 
this.

Original issue reported on code.google.com by dgryski on 29 Jan 2012 at 8:27

GoogleCodeExporter commented 9 years ago
Just realized the line number (430) is probably incorrect because I already 
modified match.go with my fix for issue # 8.

            if m1 < chunkStart {
                break
            }
+                     g.Match = true
            if g.L {
                fmt.Fprintf(g.Stdout, "%s\n", name)
                return
                        }

Original comment by dgryski on 29 Jan 2012 at 8:53

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 52cb1715a33c.

Original comment by dgryski on 2 May 2012 at 8:56