summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2018-03-11 10:33:42 -0400
committerJames M Snell <jasnell@gmail.com>2018-03-12 08:45:13 -0700
commit22b68042590de93109dbc2a4ddaf78caa24c2306 (patch)
tree1c7715f3910d3633c30b1504433890434aa33daa /lib
parent148d16ab5b297739b125716f6dea9499b947fe47 (diff)
downloadnode-new-22b68042590de93109dbc2a4ddaf78caa24c2306.tar.gz
lib: define printErr() in script string
This commit moves the printErr() function, used by the tick profiler processer, into the code string passed to vm.runInThisContext(). PR-URL: https://github.com/nodejs/node/pull/19285 Fixes: https://github.com/nodejs/node/issues/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>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/v8_prof_processor.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/internal/v8_prof_processor.js b/lib/internal/v8_prof_processor.js
index 08c712f8be..6c7a4db664 100644
--- a/lib/internal/v8_prof_processor.js
+++ b/lib/internal/v8_prof_processor.js
@@ -22,11 +22,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');
@@ -37,6 +32,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);