mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(ext/node): permission prompt for missing process.env
permissions (#22487)
Closes #18665 Closes #20213
This commit is contained in:
parent
f90889e5ee
commit
ca8bc7ece8
2 changed files with 5 additions and 9 deletions
|
@ -36,17 +36,10 @@ export const nextTick = _nextTick;
|
|||
/** Wrapper of Deno.env.get, which doesn't throw type error when
|
||||
* the env name has "=" or "\0" in it. */
|
||||
function denoEnvGet(name: string) {
|
||||
const perm =
|
||||
Deno.permissions.querySync?.({ name: "env", variable: name }).state ??
|
||||
"granted"; // for Deno Deploy
|
||||
// Returns undefined if the env permission is unavailable
|
||||
if (perm !== "granted") {
|
||||
return undefined;
|
||||
}
|
||||
try {
|
||||
return Deno.env.get(name);
|
||||
} catch (e) {
|
||||
if (e instanceof TypeError) {
|
||||
if (e instanceof TypeError || e instanceof Deno.errors.PermissionDenied) {
|
||||
return undefined;
|
||||
}
|
||||
throw e;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"version": "2",
|
||||
"version": "3",
|
||||
"remote": {
|
||||
"https://esm.sh/preact@10.15.1": "2b79349676a4942fbcf835c4efa909791c2f0aeca195225bf22bac9866e94b4e",
|
||||
"https://esm.sh/preact@10.15.1/debug": "eb12af10d41f793ab3a8cf90bff89a9cd8efab57b541d43dada6efc5e3fa8e3c",
|
||||
"https://esm.sh/stable/preact@10.15.1/denonext/debug.js": "e8e5e198bd48c93d484c91c4c78af1900bd81d9bfcfd543e8ac75216f5404c10",
|
||||
"https://esm.sh/stable/preact@10.15.1/denonext/devtools.js": "7e3009ee2208a6cc8bbf747b61e9468d177ef55d94cf9b774ad2a6c926ae51cb",
|
||||
"https://esm.sh/stable/preact@10.15.1/denonext/preact.mjs": "30710ac1d5ff3711ae0c04eddbeb706f34f82d97489f61aaf09897bc75d2a628"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue