From 3abcc74882dc8c4ab10ec9930660da2c0ab44480 Mon Sep 17 00:00:00 2001 From: Andrey Pechkurov Date: Tue, 18 Aug 2020 16:37:02 +0300 Subject: [PATCH] doc: improve async_hooks snippets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/34829 Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell Reviewed-By: Gerhard Stöbich --- doc/api/async_hooks.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md index 8a9835626b4095..8080e628617bde 100644 --- a/doc/api/async_hooks.md +++ b/doc/api/async_hooks.md @@ -273,7 +273,8 @@ async_hooks.createHook({ init(asyncId, type, triggerAsyncId) { const eid = async_hooks.executionAsyncId(); fs.writeSync( - 1, `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); + process.stdout.fd, + `${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`); } }).enable(); @@ -330,7 +331,7 @@ async_hooks.createHook({ const eid = async_hooks.executionAsyncId(); const indentStr = ' '.repeat(indent); fs.writeSync( - 1, + process.stdout.fd, `${indentStr}${type}(${asyncId}):` + ` trigger: ${triggerAsyncId} execution: ${eid}\n`); },