denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.01k stars 5.39k forks source link

interactive prompts and permission prompts interact badly #17047

Open ry opened 1 year ago

ry commented 1 year ago

In this example with Deno 1.28.3 I get prompted for permissions to /etc/npm/config and for What is your project named? at the same time

# deno run npm:create-next-app@latest
✅ Granted read access to <main_module>.
✅ Granted env access to "FORCE_COLOR".
✅ Granted env access to "CI".
✅ Granted env access to "TEAMCITY_VERSION".
✅ Granted env access to "COLORTERM".
✅ Granted env access to "NODE_DISABLE_COLORS".
✅ Granted env access to "TERM".
✅ Granted env access to "OSTYPE".
✅ Granted env access to all.
✅ Granted read access to <CWD>.
✅ Granted read access to "/var/folders/9v/kys6gqns6kl8nksyn4l1f9v40000gn/T/update-check".
✅ Granted write access to "/var/folders/9v/kys6gqns6kl8nksyn4l1f9v40000gn/T/update-check".
? What is your project named? › ⚠️  ┌ Deno requests read access to "/etc/npm/config".
   ├ Requested by `Deno.readFileSync()` API
   ├ Run again with --allow-read to bypass this prompt.
   └ Allow? [y/n] (y = yes, allow; n = no, deny) >

The program hangs here. It's not even possible to ctrl+c or ctrl+d out of it.

ktfth commented 1 year ago

Trying to understand to help on this issue, the prompt of npm mechanism is better to occur after permissions prompt?

bartlomieju commented 1 year ago

Trying to understand to help on this issue, the prompt of npm mechanism is better to occur after permissions prompt?

It's unclear - we first should debug to see what's the order of events - from the quick glance of the output above it appears that the prompt from npm module is displayed and then some async action triggers Deno's permission prompt. We should collect a few scenarios when such situation happen to try and establish if we can handle all of them (or some of them) and then think on a way to handle it. I think it might be very tricky to resolve this issue fully.