Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
be very explicit about exiting process and clearing timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnetCarpenter committed Sep 6, 2016
1 parent ecdad2a commit e8ca9ed
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions bin/codecov
Expand Up @@ -23,16 +23,24 @@ var args = argv.option([

// listen for piped input for 500ms
var listeningTime = 500;
var readingPiped = false;
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(report) {
if (report !== null) {
process.stdin.on('readable', function() {
var data = process.stdin.read();
if (data !== null) {
readingPiped = true;
clearTimeout(timer);
if (!args.options.pipe) args.options.pipe = [];
args.options.pipe.push(report);
args.options.pipe.push(data);
}
});
process.stdin.on('end', function() {
codecov.upload(args);
if (readingPiped) codecov.upload(args);
});

var timer = setTimeout(codecov.upload, listeningTime, args)
var timer = setTimeout(function() {
if (!readingPiped) {
codecov.upload(args);
process.exit();
}
}, listeningTime);

0 comments on commit e8ca9ed

Please sign in to comment.