Deno read access to CWD

Viewed 1869

How can I allow read access to CWD (current working directory) used by Deno.cwd()?
I want explicit permission only for CWD. I don't want to allow every read with plain --allow-read flag.

I've tried to pass CWD as a parameter but it doesn't work.

deno run --allow-read=CWD index.ts
Uncaught PermissionDenied: read access to <CWD>, run again with the --allow-read flag

Index.ts is just:

console.log(Deno.cwd());

I am using deno 1.2.0.

2 Answers

That actually depends on the OS you are using.

In Windows, you can use

deno run --allow-read=%cd% index.ts

In Ubuntu bash

deno run --allow-read=$PWD index.ts

Related