fix(std/node/process): env, argv exports (#6455)

The promise approach still required permissions to be specified
at initialisation, rather than at request.

Using a Proxy instance solves this permission issue.

The Proxy instance approach also eliminates the need for the
await. Achieving direct compatibility with Node.js.

/ref pr #6392
/ref commit d16337cc9c
This commit is contained in:
Benjamin Lupton 2020-06-25 21:18:01 +10:00 committed by GitHub
parent 7ea3071db5
commit 16038b8f82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 27 deletions

View file

@ -102,9 +102,9 @@ Deno.test({
Deno.test({
name: "process.argv",
async fn() {
fn() {
assert(Array.isArray(process.argv));
assert(Array.isArray(await argv));
assert(Array.isArray(argv));
assert(
process.argv[0].match(/[^/\\]*deno[^/\\]*$/),
"deno included in the file name of argv[0]"
@ -115,8 +115,8 @@ Deno.test({
Deno.test({
name: "process.env",
async fn() {
fn() {
assertEquals(typeof process.env.PATH, "string");
assertEquals(typeof (await env).PATH, "string");
assertEquals(typeof env.PATH, "string");
},
});