Comparing version 2.0.3 to 2.0.4
31
index.js
@@ -1,2 +0,4 @@ | ||
// this entire module is depressing. | ||
// this entire module is depressing. i should have spent my time learning | ||
// how to patch v8 so that these options would just be available on the | ||
// process object. | ||
@@ -29,2 +31,6 @@ const os = require('os'); | ||
var configpath = path.join(userHome || os.tmpdir(), configfile); | ||
// open file for reading and appending. if the filesize is zero | ||
// we will spawn node with --v8-options and write the parsed | ||
// options to a file. if it is larger than zero, we'll just read | ||
// the file and be done. | ||
fs.open(configpath, 'a+', function (err, fd) { | ||
@@ -50,11 +56,16 @@ if (err) { | ||
var buf = new Buffer(JSON.stringify(flags)); | ||
fs.write(fd, buf, 0, buf.length, null, function (writeErr, bytesWritten, buffer) { | ||
fs.close(fd, function (closeErr) { | ||
var err = writeErr || closeErr; | ||
if (err) { | ||
return cb(fail(err)); | ||
} | ||
return cb(null, JSON.parse(buffer.toString())); | ||
}); | ||
fs.write(fd, buf, 0, buf.length, 0, function (writeErr, bytesWritten, buffer) { | ||
// linux ignores positional arguments when files are open in append mode. | ||
// the truncate call below ensures that multiple concurrent processes | ||
// trying to write to this config will not result in a file with the | ||
// contents appended multiple times. | ||
fs.ftruncate(fd, buf.length, function (truncErr) { | ||
fs.close(fd, function (closeErr) { | ||
var err = truncErr || writeErr || closeErr; | ||
if (err) { | ||
return cb(fail(err)); | ||
} | ||
return cb(null, JSON.parse(buffer.toString())); | ||
}); | ||
}) | ||
}); | ||
@@ -61,0 +72,0 @@ }); |
{ | ||
"name": "v8flags", | ||
"description": "Get available v8 flags.", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"homepage": "https://github.com/tkellen/node-v8flags", | ||
@@ -35,2 +35,3 @@ "author": { | ||
"devDependencies": { | ||
"async": "^0.9.0", | ||
"chai": "~1.9.1", | ||
@@ -37,0 +38,0 @@ "mocha": "~1.21.4" |
@@ -1,2 +0,2 @@ | ||
# v8flags [![Build Status](https://secure.travis-ci.org/tkellen/node-v8flags.png)](http://travis-ci.org/tkellen/js-v8flags) [![Build status](https://ci.appveyor.com/api/projects/status/5jpe6yawxdllrok4?svg=true)](https://ci.appveyor.com/project/tkellen/js-v8flags) | ||
# v8flags [![Build Status](https://secure.travis-ci.org/tkellen/js-v8flags.png)](http://travis-ci.org/tkellen/js-v8flags) [![Build status](https://ci.appveyor.com/api/projects/status/5jpe6yawxdllrok4?svg=true)](https://ci.appveyor.com/project/tkellen/js-v8flags) | ||
> Get available v8 flags. | ||
@@ -26,2 +26,3 @@ | ||
* 2015-04-16 - v2.0.4 - when concurrent processes are run and no config exists, don't append to the cached config. | ||
* 2015-03-31 - v2.0.3 - prefer to store config files in user home over tmp | ||
@@ -28,0 +29,0 @@ * 2015-01-18 - v2.0.2 - keep his dark tentacles contained |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7260
96
42
3