inspector: expose inspector.close on workers · nodejs/node@8b256a3 · GitHub
Skip to content

Commit 8b256a3

Browse files
legendecasRafaelGSS
authored andcommitted
inspector: expose inspector.close on workers
Workers can open their own inspector agent with `inspector.open`. They should be able to close their own inspector agent too with `inspector.close`. PR-URL: #44489 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 353cd84 commit 8b256a3

4 files changed

Lines changed: 38 additions & 6 deletions

File tree

doc/api/inspector.md

Lines changed: 0 additions & 3 deletions

lib/inspector.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const {
3232
validateString,
3333
} = require('internal/validators');
3434
const { isMainThread } = require('worker_threads');
35+
const { _debugEnd } = internalBinding('process_methods');
3536

3637
const {
3738
Connection,
@@ -195,7 +196,7 @@ function inspectorWaitForDebugger() {
195196

196197
module.exports = {
197198
open: inspectorOpen,
198-
close: process._debugEnd,
199+
close: _debugEnd,
199200
url,
200201
waitForDebugger: inspectorWaitForDebugger,
201202
console,

src/node_process_methods.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,24 +562,24 @@ static void Initialize(Local<Object> target,
562562
// define various internal methods
563563
if (env->owns_process_state()) {
564564
SetMethod(context, target, "_debugProcess", DebugProcess);
565-
SetMethod(context, target, "_debugEnd", DebugEnd);
566565
SetMethod(context, target, "abort", Abort);
567566
SetMethod(context, target, "causeSegfault", CauseSegfault);
568567
SetMethod(context, target, "chdir", Chdir);
569568
}
570569

571570
SetMethod(context, target, "umask", Umask);
572-
SetMethod(context, target, "_rawDebug", RawDebug);
573571
SetMethod(context, target, "memoryUsage", MemoryUsage);
574572
SetMethod(context, target, "rss", Rss);
575573
SetMethod(context, target, "cpuUsage", CPUUsage);
576574
SetMethod(context, target, "resourceUsage", ResourceUsage);
577575

576+
SetMethod(context, target, "_debugEnd", DebugEnd);
578577
SetMethod(context, target, "_getActiveRequestsInfo", GetActiveRequestsInfo);
579578
SetMethod(context, target, "_getActiveRequests", GetActiveRequests);
580579
SetMethod(context, target, "_getActiveHandles", GetActiveHandles);
581580
SetMethod(context, target, "_getActiveHandlesInfo", GetActiveHandlesInfo);
582581
SetMethod(context, target, "_kill", Kill);
582+
SetMethod(context, target, "_rawDebug", RawDebug);
583583

584584
SetMethodNoSideEffect(context, target, "cwd", Cwd);
585585
SetMethod(context, target, "dlopen", binding::DLOpen);
Lines changed: 34 additions & 0 deletions

0 commit comments

Comments
 (0)