Created
July 29, 2015 17:52
-
-
Save natpen/9ea5e5c7b7ad94e8bd8b to your computer and use it in GitHub Desktop.
Revisions
-
natpen created this gist
Jul 29, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ var extend = require('extend'); var spawn = require('child_process').spawn; var csv = require('csv'); var ls = spawn('git', ['log']); ls.stdout.on('data', function (data) { parser.write(data); }); ls.on('close', function (code) { // parser.end(); // either I call parser.end() explicitly and it // gets called before readable work finishes, or it // never gets called at all console.log('exit code ' + code); }); var parser = csv.parse({delimiter: '\t'}); parser.on('readable', function() { while(data = parser.read()) { setTimeout(function() { console.log('---'); }, 10); } }); parser.on('end', function() { console.log('parser end'); }); parser.on('finish', function() { console.log('parser finish'); });