Skip to content

Commit 3abcc74

Browse files
puzpuzpuzaddaleax
authored andcommitted
doc: improve async_hooks snippets
PR-URL: #34829 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
1 parent fd4f561 commit 3abcc74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/api/async_hooks.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ async_hooks.createHook({
273273
init(asyncId, type, triggerAsyncId) {
274274
const eid = async_hooks.executionAsyncId();
275275
fs.writeSync(
276-
1, `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`);
276+
process.stdout.fd,
277+
`${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`);
277278
}
278279
}).enable();
279280

@@ -330,7 +331,7 @@ async_hooks.createHook({
330331
const eid = async_hooks.executionAsyncId();
331332
const indentStr = ' '.repeat(indent);
332333
fs.writeSync(
333-
1,
334+
process.stdout.fd,
334335
`${indentStr}${type}(${asyncId}):` +
335336
` trigger: ${triggerAsyncId} execution: ${eid}\n`);
336337
},

0 commit comments

Comments
 (0)