yargs / yargs-parser

:muscle: the mighty option parser used by yargs
http://yargs.js.org/
ISC License
492 stars 120 forks source link

`yargs().env()` always fails in deno runtime #405

Closed reosablo closed 1 year ago

reosablo commented 3 years ago

This is a small reproducible code:

// example.ts
import yargs from "https://deno.land/x/yargs@v17.0.1-deno/deno.ts";
yargs().env().parse([]);
deno run example.ts              # uncaught error: permission denied
deno run --allow-env example.ts  # uncaught error: Object.keys(undefined)

Maybe, that's because env() in deno.ts:12:14 returns nothing and doesn't handle PermissionDenied errors like this:

  env: () => {
    Deno.env.toObject()
  },
MaikuMori commented 1 year ago

Can I make PR to fix this?

reosablo commented 1 year ago

@MaikuMori I didn't follow this issue but it seems to have been fixed in #432.