lune-org / lune

A standalone Luau runtime
https://lune-org.github.io/docs
Mozilla Public License 2.0
386 stars 89 forks source link

`stdio.prompt` can crash PowerShell #249

Open metatablecat opened 2 months ago

metatablecat commented 2 months ago

this may be a dupllicate of #241 but I'll provide some extra repro steps, it may take a few tries.

Run lune and type in these two lines:

stdio = require("@lune/stdio")
stdio.prompt("text", "hi")

Next, press Ctrl-C to exit out of the prompt prematurely. Press "up", and powershell will crash. I haven't been able to replicate this behaviour in cmd

CompeyDev commented 2 months ago

image

I can't seem to replicate this. I've faced a similar issue on Linux where the cursor disappears on selection menus on exiting with a SIGINT, since the ANSI doesn't get reset, but that's a much smaller issue compared to an entire shell crash.

metatablecat commented 2 months ago

image

I can't seem to replicate this. I've faced a similar issue on Linux where the cursor disappears on selection menus on exiting with a SIGINT, since the ANSI doesn't get reset, but that's a much smaller issue compared to an entire shell crash.

Try it without putting anything in the input field.

CompeyDev commented 2 months ago

I didn't put anything in the field though?

metatablecat commented 2 months ago

oops im dumb :3

uh yeah im not exactly sure how to repro it specifically, it doesn't always happen from what i've tested so it could be anything? I'll send a picture so it doesn't look like im crazy (im not crazy right?)

Regardless, here's proof of it crashing out of powershell in cmd image

CompeyDev commented 2 months ago

Odd, if you face this again, can you give the exit code of powershell? I believe you can get it by echoing %ERRORLEVEL% in command prompt after powershell exits (I'm not sure though).

metatablecat commented 2 months ago

image /shrug

i can get more detailed info on it in event viewer but github wont allow EVTX

Sythivo commented 1 month ago

This is most likely to due to the Console Mode changed while using stdio.prompt left in a state in which powershell does not like. Lune would have to restore the console mode back to original or default state.

CompeyDev commented 1 month ago

This is most likely to due to the Console Mode changed while using stdio.prompt left in a state in which powershell does not like. Lune would have to restore the console mode back to original or default state.

Lune doesn't manually depend on the windows API, but rather uses a crate called console for abstracting around cross-platform terminals. If what you are saying is true, this should be taken up as an issue with the above crate.