process: fix symbol key and mark experimental new `node:process` methods · nodejs/node@3f69b18 · GitHub
Skip to content

Commit 3f69b18

Browse files
committed
process: fix symbol key and mark experimental new node:process methods
PR-URL: #56517 Backport-PR-URL: #56571 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent d35333a commit 3f69b18

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

doc/api/process.md

Lines changed: 8 additions & 4 deletions

lib/internal/process/per_thread.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,14 @@ function toggleTraceCategoryState(asyncHooksEnabled) {
425425
const { arch, platform, version } = process;
426426

427427
function ref(maybeRefable) {
428-
const fn = maybeRefable?.[SymbolFor('node:ref')] || maybeRefable?.ref;
428+
const fn = maybeRefable?.[SymbolFor('nodejs.ref')] || maybeRefable?.[SymbolFor('node:ref')] || maybeRefable?.ref;
429429
if (typeof fn === 'function') FunctionPrototypeCall(fn, maybeRefable);
430430
}
431431

432432
function unref(maybeRefable) {
433-
const fn = maybeRefable?.[SymbolFor('node:unref')] || maybeRefable?.unref;
433+
const fn = maybeRefable?.[SymbolFor('nodejs.unref')] ||
434+
maybeRefable?.[SymbolFor('node:unref')] ||
435+
maybeRefable?.unref;
434436
if (typeof fn === 'function') FunctionPrototypeCall(fn, maybeRefable);
435437
}
436438

test/parallel/test-process-ref-unref.js

Lines changed: 17 additions & 0 deletions

0 commit comments

Comments
 (0)