Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
lib: replace eval with vm.runInThisContext
  • Loading branch information
MylesBorins committed Feb 13, 2018
commit 4dd27499ed617598ec729642aa5e2ce5628720cc
11 changes: 7 additions & 4 deletions lib/internal/v8_prof_processor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* eslint-disable strict */
'use strict';

const vm = require('vm');

const scriptFiles = [
'internal/v8_prof_polyfill',
'internal/deps/v8/tools/splaytree',
Expand Down Expand Up @@ -31,9 +34,9 @@ if (process.platform === 'darwin') {
tickArguments.push('--windows');
}
tickArguments.push.apply(tickArguments, process.argv.slice(1));
script = `(function() {
script = `(function(require) {
arguments = ${JSON.stringify(tickArguments)};
function write (s) { process.stdout.write(s) }
${script}
})()`;
eval(script);
})`;
vm.runInThisContext(script)(require);