From 2e50c9b5e53af2fe9f7ae3c97559a2fd486f794a Mon Sep 17 00:00:00 2001 From: lino-levan <11367844+lino-levan@users.noreply.github.com> Date: Tue, 24 Jan 2023 16:07:35 -0800 Subject: [PATCH 1/3] fix: don't unnecessarily ask for env variable --- node/internal/util/debuglog.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/node/internal/util/debuglog.ts b/node/internal/util/debuglog.ts index 73c86286446a..193835ef4936 100644 --- a/node/internal/util/debuglog.ts +++ b/node/internal/util/debuglog.ts @@ -104,15 +104,12 @@ export function debuglog( } let debugEnv; -try { +if (Deno.permissions.querySync({ name: "env", variable: "NODE_DEBUG" })) { debugEnv = Deno.env.get("NODE_DEBUG") ?? ""; -} catch (error) { - if (error instanceof Deno.errors.PermissionDenied) { - debugEnv = ""; - } else { - throw error; - } +} else { + debugEnv = ""; } + initializeDebugEnv(debugEnv); export default { debuglog }; From 1ec0fbb0a0d4737172829de2018dc49d0f789874 Mon Sep 17 00:00:00 2001 From: Lino Le Van <11367844+lino-levan@users.noreply.github.com> Date: Thu, 9 Feb 2023 11:59:29 -0800 Subject: [PATCH 2/3] Update node/internal/util/debuglog.ts Co-authored-by: Yoshiya Hinosawa --- node/internal/util/debuglog.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/internal/util/debuglog.ts b/node/internal/util/debuglog.ts index 193835ef4936..2c254fd358ac 100644 --- a/node/internal/util/debuglog.ts +++ b/node/internal/util/debuglog.ts @@ -104,7 +104,7 @@ export function debuglog( } let debugEnv; -if (Deno.permissions.querySync({ name: "env", variable: "NODE_DEBUG" })) { +if (Deno.permissions.querySync({ name: "env", variable: "NODE_DEBUG" }).state === "granted") { debugEnv = Deno.env.get("NODE_DEBUG") ?? ""; } else { debugEnv = ""; From b2848b9e266d0073ed17ead2c88752102cbbeb89 Mon Sep 17 00:00:00 2001 From: lino-levan <11367844+lino-levan@users.noreply.github.com> Date: Thu, 9 Feb 2023 12:21:40 -0800 Subject: [PATCH 3/3] fmt --- node/internal/util/debuglog.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/node/internal/util/debuglog.ts b/node/internal/util/debuglog.ts index 2c254fd358ac..2332b4587a7c 100644 --- a/node/internal/util/debuglog.ts +++ b/node/internal/util/debuglog.ts @@ -104,7 +104,10 @@ export function debuglog( } let debugEnv; -if (Deno.permissions.querySync({ name: "env", variable: "NODE_DEBUG" }).state === "granted") { +if ( + Deno.permissions.querySync({ name: "env", variable: "NODE_DEBUG" }).state === + "granted" +) { debugEnv = Deno.env.get("NODE_DEBUG") ?? ""; } else { debugEnv = "";