File tree 3 files changed +16
-4
lines changed
3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,9 @@ if (isMainThread) {
115
115
}
116
116
117
117
const {
118
- onWarning,
119
118
emitWarning
120
119
} = NativeModule . require ( 'internal/process/warning' ) ;
121
- if ( ! process . noProcessWarnings && process . env . NODE_NO_WARNINGS !== '1' ) {
122
- process . on ( 'warning' , onWarning ) ;
123
- }
120
+
124
121
process . emitWarning = emitWarning ;
125
122
126
123
const {
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ let traceEventsAsyncHook;
8
8
function prepareMainThreadExecution ( ) {
9
9
setupTraceCategoryState ( ) ;
10
10
11
+ setupWarningHandler ( ) ;
12
+
11
13
// Only main thread receives signals.
12
14
setupSignalHandlers ( ) ;
13
15
@@ -36,6 +38,15 @@ function prepareMainThreadExecution() {
36
38
loadPreloadModules ( ) ;
37
39
}
38
40
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
+
39
50
function initializeReport ( ) {
40
51
if ( ! getOptionValue ( '--experimental-report' ) ) {
41
52
return ;
@@ -268,6 +279,7 @@ function loadPreloadModules() {
268
279
}
269
280
270
281
module . exports = {
282
+ setupWarningHandler,
271
283
prepareMainThreadExecution,
272
284
initializeDeprecations,
273
285
initializeESMLoader,
Original file line number Diff line number Diff line change 4
4
// message port.
5
5
6
6
const {
7
+ setupWarningHandler,
7
8
initializeDeprecations,
8
9
initializeESMLoader,
9
10
initializeFrozenIntrinsics,
@@ -39,6 +40,8 @@ const {
39
40
const publicWorker = require ( 'worker_threads' ) ;
40
41
const debug = require ( 'util' ) . debuglog ( 'worker' ) ;
41
42
43
+ setupWarningHandler ( ) ;
44
+
42
45
debug ( `[${ threadId } ] is setting up worker child environment` ) ;
43
46
44
47
// Set up the message port and start listening
You can’t perform that action at this time.
0 commit comments