diff --git a/fetch.js b/fetch.js index e37dd63..b780c65 100644 --- a/fetch.js +++ b/fetch.js @@ -1,18 +1,17 @@ const fs = require('fs'); const path = require('path'); -const exec = require('child_process').exec; -const nodePath = process.execPath; const version = process.versions.v8; const tmpfile = path.join(__dirname, version+'.flags.json'); +const flagsFile = path.join(__dirname, 'flags.temp'); if (!fs.existsSync(tmpfile)) { - exec('"'+nodePath+'" --v8-options', function (execErr, result) { + fs.readFile( flagsFile, function( execErr, result) { var flags; if (execErr) { throw new Error(execErr); } else { - flags = result.match(/\s\s--(\w+)/gm).map(function (match) { + flags = result.toString().match(/\s\s--(\w+)/gm).map(function (match) { return match.substring(2); }); fs.writeFile(tmpfile, JSON.stringify(flags), { encoding:'utf8' }, diff --git a/package.json b/package.json index dfaea10..9e30c3a 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ } ], "scripts": { + "preinstall": "node --v8-options >> flags.temp", "install": "node fetch.js", "test": "mocha -R spec test.js" },