Skip to content

Commit

Permalink
Updated lib check
Browse files Browse the repository at this point in the history
  • Loading branch information
cadebrown committed Sep 23, 2016
1 parent 8a219ef commit 8c68f54
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions PGS.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,27 @@ parser.addArgument(
action: 'storeTrue'
}
);
try {
fs.accessSync(PRIME_FILE);
run();
} catch (e) {
//Run error
error("Error no prime file! Generating one now.");
error(JSON.stringify(e));
//Spawn
const pp = spawn("./lib.o", [PRIME_FILE]);

fs.accessSync(PRIME_FILE, fs.F_OK, function(err) {
if (err) {
//Run error
error("Error no prime file! Generating one now.");
//Spawn
const pp = spawn("./lib.o", [PRIME_FILE]);

//Log all output
pp.stdout.on('data', (data) => {
log(data.toString());
});
//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`);
run();
});
} else {
//When it closes, handle it
pp.on('close', function (code) {
log(`lib Has Finished`);
run();
}
});
});
}

//We store our parsed args
var args = parser.parseArgs();
Expand Down

0 comments on commit 8c68f54

Please sign in to comment.