Skip to content

Commit

Permalink
lib: define printErr() in script string
Browse files Browse the repository at this point in the history
This commit moves the printErr() function, used by the
tick profiler processer, into the code string passed to
vm.runInThisContext().

PR-URL: #19285
Fixes: #19260
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
cjihrig authored and addaleax committed Sep 13, 2018
1 parent 1519657 commit 2ae98ce
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/internal/v8_prof_processor.js
Expand Up @@ -21,11 +21,6 @@ scriptFiles.forEach(function(s) {
script += process.binding('natives')[s] + '\n';
});

// eslint-disable-next-line no-unused-vars
function printErr(err) {
console.error(err);
}

const tickArguments = [];
if (process.platform === 'darwin') {
tickArguments.push('--mac');
Expand All @@ -36,6 +31,7 @@ tickArguments.push.apply(tickArguments, process.argv.slice(1));
script = `(function(module, require) {
arguments = ${JSON.stringify(tickArguments)};
function write (s) { process.stdout.write(s) }
function printErr(err) { console.error(err); }
${script}
})`;
vm.runInThisContext(script)(module, require);

0 comments on commit 2ae98ce

Please sign in to comment.