Skip to content

Commit

Permalink
Added logging for v2
Browse files Browse the repository at this point in the history
  • Loading branch information
cadebrown committed Sep 23, 2016
1 parent f0c0506 commit f395654
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions PGS.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ var queue;
//Progress functions
var reject_funcs;

error("Started running at " + new Date().toString());

if (args.download > 0) {
initFirebase(function () {
Expand Down Expand Up @@ -110,14 +111,9 @@ try {
//Spawn
const pp = spawn("./lib.o", [PRIME_FILE]);

//Log all output
pp.stdout.on('data', (data) => {
log(data.toString());
});

//When it closes, handle it
pp.on('close', function (code) {
log(`lib Has Finished`);
log(`lib Has finished generating primes.dat`);
callback();
});
}
Expand Down Expand Up @@ -355,16 +351,20 @@ function log_progress(txt) {
log("Progress: " + txt + "%");
}
function shutdown() {
var final = function () {
error("Stopped running at " + new Date().toString());
process.exit(0);
}
log("Shutting down");
if (queue) {
for (var f in prog_funcs) {
reject_funcs[f]("Shut down");
}
queue.shutdown().then(function () {
process.exit(0);
final();
});
} else {
process.exit(0);
final();
}
}

Expand Down

0 comments on commit f395654

Please sign in to comment.