antfu-collective / ni

💡 Use the right package manager
MIT License
6.25k stars 208 forks source link

using nr in vscode integrated terminal on Windows, only 1 out of 2 keystrokes works after exiting. #203

Open eai04191 opened 7 months ago

eai04191 commented 7 months ago

Describe the bug

When starting commands such as vite dev or next dev from nr, the terminal input may be corrupted when exiting. The following is a reproduction of what happens in each environment when using vite dev.

The problem doesn't occur with npm run dev, so I'm thinking it might be an nr issue.

https://github.com/antfu/ni/assets/3516343/c43d90ac-4945-4036-97c0-2bd5170a819a

  1. Create a vite project with npm create, perform npm install
  2. Use npm run dev in windows terminal and exit with Ctrl+C, Y, Enter
    • No problem.
  3. Use npm run dev in windows terminal and exit with Ctrl+C, Ctrl+C
    • No problem.
  4. Use nr dev in windows terminal and exit with Ctrl+C, Y, Enter
    • Nothing will be displayed, but if you press Enter several times it will return to normal.
  5. Use nr dev in windows terminal and exit with Ctrl+C, Ctrl+C
    • ^C is displayed. Then press Enter and it will go back to normal.
  6. In the vscode integrated terminal, use npm run dev and exit with Ctrl+C, Y, Enter
    • No problem.
  7. In the vscode integrated terminal, use npm run dev and exit with Ctrl+C, Ctrl+C
    • No problem.
  8. In the vscode integrated terminal, use nr dev and exit with Ctrl+C, Y, Enter
    • Nothing will be displayed, but if you press Enter several times it will return to normal.
  9. In the vscode integrated terminal, use nr dev and exit with Ctrl+C, Ctrl+C
    • ^C is displayed. Even if you press Enter, it doesn't seem to be finished yet, so press Ctrl+C again. It looks like it's finished, but my keystrokes only respond once in two until I close the terminal. It is extremely painful.

workaround

https://github.com/antfu/ni/assets/3516343/7d181035-a809-4ccc-847b-f67b926e8b52

In writing this issue, I found a workaround. Press Ctrl+C and after "Terminate batch job (Y/N)?" is displayed, press Ctrl+C three times. The message continues to remain on the screen, but I was able to avoid a situation where I could not type it.

Reproduction

In the vscode integrated terminal, use nr dev and exit with Ctrl+C, Ctrl+C

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700KF
    Memory: 42.36 GB / 63.82 GB
  Binaries:
    Node: 20.11.1 - ~\AppData\Local\Volta\tools\image\node\20.11.1\node.EXE
    Yarn: 1.22.21 - ~\AppData\Local\Volta\tools\image\yarn\1.22.21\bin\yarn.CMD
    npm: 10.2.4 - ~\AppData\Local\Volta\tools\image\node\20.11.1\npm.CMD
  Browsers:
    Edge: Chromium (121.0.2277.112)
    Internet Explorer: 11.0.22621.1

Used Package Manager

npm

Validations