8000 Merge pull request #33 from codeclimate/jp/fix-buffering · codeclimate/codeclimate-fixme@a44e8d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit a44e8d4

Browse files
committed
Merge pull request #33 from codeclimate/jp/fix-buffering
Don't try to parse output until finished
2 parents df1a1e4 + f7f966d commit a44e8d4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/fix-me.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,17 @@ FixMe.prototype.runEngine = function(){
3838
FixMe.prototype.find = function(files, strings){
3939
var fixmeStrings = '(' + strings.join('|') + ')';
4040
var grep = spawn('grep', ['-nHwoEr', fixmeStrings].concat(files));
41+
var output = "";
4142
var self = this;
4243

43-
grep.stdout.on('data', function (data) {
44-
var results = data.toString();
44+
grep.stdout.on('data', function(data) {
45+
output += data.toString();
46+
});
4547

46-
if (results !== ""){
48+
grep.on('exit', function() {
49+
if (output !== ""){
4750
// Parses grep output
48-
var lines = results.split("\n");
51+
var lines = output.split("\n");
4952

5053
lines.forEach(function(line, index, array){
5154
// grep spits out an extra line that we can ignore

0 commit comments

Comments
 (0)
0