mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
18 lines
484 B
JavaScript
18 lines
484 B
JavaScript
|
const { Session } = require('inspector');
|
||
|
const { parentPort } = require('worker_threads');
|
||
|
|
||
|
const session = new Session();
|
||
|
|
||
|
parentPort.once('message', () => {}); // Prevent the worker from exiting.
|
||
|
|
||
|
session.connectToMainThread();
|
||
|
|
||
|
session.on(
|
||
|
'NodeWorker.attachedToWorker',
|
||
|
({ params: { workerInfo } }) => {
|
||
|
// send the worker title to the main thread
|
||
|
parentPort.postMessage(workerInfo.title);
|
||
|
}
|
||
|
);
|
||
|
session.post('NodeWorker.enable', { waitForDebuggerOnStart: false });
|