diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 7d3d267123da95..2cd13a2891068c 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -46,24 +46,6 @@ setupTraceCategoryState(); setupProcessObject(); -// TODO(joyeecheung): this does not have to done so early, any fatal errors -// thrown before user code execution should simply crash the process -// and we do not care about any clean up at that point. We don't care -// about emitting any events if the process crash upon bootstrap either. -{ - const { - fatalException, - setUncaughtExceptionCaptureCallback, - hasUncaughtExceptionCaptureCallback - } = NativeModule.require('internal/process/execution'); - - process._fatalException = fatalException; - process.setUncaughtExceptionCaptureCallback = - setUncaughtExceptionCaptureCallback; - process.hasUncaughtExceptionCaptureCallback = - hasUncaughtExceptionCaptureCallback; -} - setupGlobalProxy(); setupBuffer(); @@ -265,6 +247,20 @@ Object.defineProperty(process, 'features', { } }); +{ + const { + fatalException, + setUncaughtExceptionCaptureCallback, + hasUncaughtExceptionCaptureCallback + } = NativeModule.require('internal/process/execution'); + + process._fatalException = fatalException; + process.setUncaughtExceptionCaptureCallback = + setUncaughtExceptionCaptureCallback; + process.hasUncaughtExceptionCaptureCallback = + hasUncaughtExceptionCaptureCallback; +} + // User-facing NODE_V8_COVERAGE environment variable that writes // ScriptCoverage to a specified file. if (process.env.NODE_V8_COVERAGE) {