MCPcopy Index your code
hub / github.com/nodejs/node / getDebuggedPid

Function getDebuggedPid

test/sequential/test-watch-mode-inspect.mjs:14–25  ·  view source on GitHub ↗
(instance, waitForLog = true)

Source from the content-addressed store, hash-verified

12common.skipIfInspectorDisabled();
13
14async function getDebuggedPid(instance, waitForLog = true) {
15 const session = await instance.connectInspectorSession();
16 await session.send({ method: 'Runtime.enable' });
17 if (waitForLog) {
18 await session.waitForConsoleOutput('log', 'safe to debug now');
19 }
20 const { value: innerPid } = (await session.send({
21 'method': 'Runtime.evaluate', 'params': { 'expression': 'process.pid' },
22 })).result;
23 session.disconnect();
24 return innerPid;
25}
26
27// Triggers a single restart and resolves when the restarted child prints "safe to debug now".
28function restartAndWaitForReady(file, instance) {

Callers 1

Calls 4

waitForConsoleOutputMethod · 0.80
sendMethod · 0.65
disconnectMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…