oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.54k stars 2.71k forks source link

PowerShell terminal crashes after using `C^c` in Windows 11 #11528

Open alexeira opened 4 months ago

alexeira commented 4 months ago

What version of Bun is running?

1.1.12+43f0913c3

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

I usually get this error after doing a C^c to finish a simple bun run --watch index.ts script, I have the suspicion that it is something from PSReadLine, but not having so much knowledge I don't know if the problem comes from there.

I have tried disabling PSReadline and I still get this error.

It also usually happens just after doing a bun -h and just waiting a few seconds or typing any key.

What is the expected behavior?

Not an error, I hope to continue with the development cycle.

What do you see instead?

An error has occurred that was not properly handled. Additional information is shown below. The PowerShell process will exit.
Unhandled exception. System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
   at System.ConsolePal.ReadKey(Boolean intercept)
   at Microsoft.PowerShell.Internal.VirtualTerminal.ReadKey()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadOneOrMoreKeys()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadKeyThreadProc()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

Additional information

Certainly it could be a crash error, but as it is not a bun error as such but an unexpected behavior of the terminal I place it as bug and not as crash.

I want to note that when using the pwsh terminal in vscode I don't get this error.

stevebeauge commented 3 months ago

Dup of https://github.com/oven-sh/bun/issues/10592 ?

alexeira commented 3 months ago

Dup of #10592 ?

It seems that it is the same type of error, even so, I emphasize again that it also happened to me when pressing C^c and that it was in Windows 11.

Also that since version 1.1.16 onwards, the error has not reappeared.