diff --git a/lib/internal/v8_prof_processor.js b/lib/internal/v8_prof_processor.js index 01b81c6ba56492..bb71213a8f4dae 100644 --- a/lib/internal/v8_prof_processor.js +++ b/lib/internal/v8_prof_processor.js @@ -1,4 +1,7 @@ -/* eslint-disable strict */ +'use strict'; + +const vm = require('vm'); + const scriptFiles = [ 'internal/v8_prof_polyfill', 'v8/tools/splaytree', @@ -30,9 +33,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);