Skip to content

Commit f39a121

Browse files
puzpuzpuzjasnell
authored andcommitted
doc: improve async_hooks snippets
PR-URL: #34829 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
1 parent 68ccd16 commit f39a121

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

@@ -325,7 +326,7 @@ async_hooks.createHook({
325326
const eid = async_hooks.executionAsyncId();
326327
const indentStr = ' '.repeat(indent);
327328
fs.writeSync(
328-
1,
329+
process.stdout.fd,
329330
`${indentStr}${type}(${asyncId}):` +
330331
` trigger: ${triggerAsyncId} execution: ${eid}\n`);
331332
},

0 commit comments

Comments
 (0)