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

Pipe - cleaned up and merged with master #92

Merged
merged 17 commits into from
Apr 2, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
be very explicit about exiting process and clearing timeout
  • Loading branch information
dotnetCarpenter committed Sep 6, 2016
commit e8ca9edb986a25d8ed1ab5755bb001812c372a48
18 changes: 13 additions & 5 deletions bin/codecov
Original file line number Diff line number Diff line change
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);