Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Loring <mattloring@google.com>2015-12-09 22:37:51 +0300
committerAli Ijaz Sheikh <ofrobots@google.com>2015-12-30 01:14:43 +0300
commit3e2a2e6efa40ca1ae2d5161ab2844a1787391a9e (patch)
tree09ea5c510159f09e0af6e830617f2f51b42319dc /lib/internal/v8_prof_polyfill.js
parent1762db0142b137d0dcc949cd38894a2b07adf18a (diff)
tools: run tick processor without forking
Using the tick processor no longer creates temporary files or spawns a child process. PR-URL: https://github.com/nodejs/node/pull/4224 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/v8_prof_polyfill.js')
-rw-r--r--lib/internal/v8_prof_polyfill.js28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/internal/v8_prof_polyfill.js b/lib/internal/v8_prof_polyfill.js
index 1beae0e4e4b..755f8f0d65d 100644
--- a/lib/internal/v8_prof_polyfill.js
+++ b/lib/internal/v8_prof_polyfill.js
@@ -26,40 +26,42 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Node polyfill
-var fs = require('fs');
-var os = {
+const fs = require('fs');
+const cp = require('child_process');
+const os = {
system: function(name, args) {
if (process.platform === 'linux' && name === 'nm') {
// Filter out vdso and vsyscall entries.
- var arg = args[args.length - 1];
+ const arg = args[args.length - 1];
if (arg === '[vdso]' ||
arg == '[vsyscall]' ||
/^[0-9a-f]+-[0-9a-f]+$/.test(arg)) {
return '';
}
+ } else if (process.platform === 'darwin') {
+ args.unshift('-c', name);
+ name = '/bin/sh';
}
- return require('child_process').execFileSync(
- name, args, {encoding: 'utf8'});
+ return cp.spawnSync(name, args).stdout.toString();
}
};
-var print = console.log;
+const print = console.log;
function read(fileName) {
return fs.readFileSync(fileName, 'utf8');
}
-arguments = process.argv.slice(2);
-var quit = process.exit;
+const quit = process.exit;
// Polyfill "readline()".
-var logFile = arguments[arguments.length - 1];
+const logFile = arguments[arguments.length - 1];
try {
fs.accessSync(logFile);
} catch(e) {
console.error('Please provide a valid isolate file as the final argument.');
process.exit(1);
}
-var fd = fs.openSync(logFile, 'r');
-var buf = new Buffer(4096);
-var dec = new (require('string_decoder').StringDecoder)('utf-8');
+const fd = fs.openSync(logFile, 'r');
+const buf = new Buffer(4096);
+const dec = new (require('string_decoder').StringDecoder)('utf-8');
var line = '';
versionCheck();
function readline() {
@@ -85,7 +87,7 @@ function versionCheck() {
var firstLine = readline();
line = firstLine + '\n' + line;
firstLine = firstLine.split(',');
- var curVer = process.versions.v8.split('.');
+ const curVer = process.versions.v8.split('.');
if (firstLine.length !== 6 && firstLine[0] !== 'v8-version') {
console.log('Unable to read v8-version from log file.');
return;