Skip to content

Commit 4824c10

Browse files
cjihrigMayaLekova
authored andcommitted
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: nodejs#19285 Fixes: nodejs#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>
1 parent 1a6d8d3 commit 4824c10

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/internal/v8_prof_processor.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ scriptFiles.forEach(function(s) {
2222
script += process.binding('natives')[s] + '\n';
2323
});
2424

25-
// eslint-disable-next-line no-unused-vars
26-
function printErr(err) {
27-
console.error(err);
28-
}
29-
3025
const tickArguments = [];
3126
if (process.platform === 'darwin') {
3227
tickArguments.push('--mac');
@@ -37,6 +32,7 @@ tickArguments.push.apply(tickArguments, process.argv.slice(1));
3732
script = `(function(module, require) {
3833
arguments = ${JSON.stringify(tickArguments)};
3934
function write (s) { process.stdout.write(s) }
35+
function printErr(err) { console.error(err); }
4036
${script}
4137
})`;
4238
vm.runInThisContext(script)(module, require);

0 commit comments

Comments
 (0)