File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,9 @@ if (isMainThread) {
115115}
116116
117117const {
118- onWarning,
119118 emitWarning
120119} = NativeModule . require ( 'internal/process/warning' ) ;
121- if ( ! process . noProcessWarnings && process . env . NODE_NO_WARNINGS !== '1' ) {
122- process . on ( 'warning' , onWarning ) ;
123- }
120+
124121process . emitWarning = emitWarning ;
125122
126123const {
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ let traceEventsAsyncHook;
88function prepareMainThreadExecution ( ) {
99 setupTraceCategoryState ( ) ;
1010
11+ setupWarningHandler ( ) ;
12+
1113 // Only main thread receives signals.
1214 setupSignalHandlers ( ) ;
1315
@@ -36,6 +38,15 @@ function prepareMainThreadExecution() {
3638 loadPreloadModules ( ) ;
3739}
3840
41+ function setupWarningHandler ( ) {
42+ const {
43+ onWarning
44+ } = require ( 'internal/process/warning' ) ;
45+ if ( ! process . noProcessWarnings && process . env . NODE_NO_WARNINGS !== '1' ) {
46+ process . on ( 'warning' , onWarning ) ;
47+ }
48+ }
49+
3950function initializeReport ( ) {
4051 if ( ! getOptionValue ( '--experimental-report' ) ) {
4152 return ;
@@ -245,6 +256,7 @@ function loadPreloadModules() {
245256}
246257
247258module . exports = {
259+ setupWarningHandler,
248260 prepareMainThreadExecution,
249261 initializeDeprecations,
250262 initializeESMLoader,
Original file line number Diff line number Diff line change 44// message port.
55
66const {
7+ setupWarningHandler,
78 initializeDeprecations,
89 initializeESMLoader,
910 initializeFrozenIntrinsics,
@@ -39,6 +40,8 @@ const {
3940const publicWorker = require ( 'worker_threads' ) ;
4041const debug = require ( 'util' ) . debuglog ( 'worker' ) ;
4142
43+ setupWarningHandler ( ) ;
44+
4245debug ( `[${ threadId } ] is setting up worker child environment` ) ;
4346
4447// Set up the message port and start listening
You can’t perform that action at this time.
0 commit comments