1'use strict'; 2 3const { ObjectDefineProperty } = primordials; 4 5delete process._debugProcess; 6delete process._debugEnd; 7 8function defineStream(name, getter) { 9 ObjectDefineProperty(process, name, { 10 configurable: true, 11 enumerable: true, 12 get: getter 13 }); 14} 15 16defineStream('stdout', getStdout); 17defineStream('stdin', getStdin); 18defineStream('stderr', getStderr); 19 20// Worker threads don't receive signals. 21const { 22 startListeningIfSignal, 23 stopListeningIfSignal 24} = require('internal/process/signal'); 25process.removeListener('newListener', startListeningIfSignal); 26process.removeListener('removeListener', stopListeningIfSignal); 27 28// ---- keep the attachment of the wrappers above so that it's easier to ---- 29// ---- compare the setups side-by-side ----- 30 31const { 32 createWorkerStdio 33} = require('internal/worker/io'); 34 35let workerStdio; 36function lazyWorkerStdio() { 37 if (!workerStdio) workerStdio = createWorkerStdio(); 38 return workerStdio; 39} 40 41function getStdout() { return lazyWorkerStdio().stdout; } 42 43function getStderr() { return lazyWorkerStdio().stderr; } 44 45function getStdin() { return lazyWorkerStdio().stdin; } 46