windows terminal breaks on `ctrl+C`
Describe the bug
https://discord.com/channels/1212416027611365476/1317009958113644554
Reproduction
I don't have Windows, see discord.
Steps to reproduce
pnpm dev
System Info
TODO
Used Package Manager
pnpm
Validations
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Here's the loom video from my window's 10 system.
I don't think so it seems to be the case with readline (still skeptical tho).
Cause in the video you can see after terminating server. My powershell seems to be loading properly.
But that is also very inconsistent.
But after running pnpm test command it crashes.
@nishu-murmu So with my readline change, you can press ctrl+C twice and everything works just fine? Still need to figure out why the prompt get's messed up... but that fix does make some progress, right?
@aklinker1
Yeah, in my powershell it seems to be working.
In windows it does works but very inconsistent, sometimes I also face that crash issue where powershell gets useless and am not able to enter any command.
In linux it is showing something like this.
Windows is more problematic.
Maybe we need to handle that exit code 130 thing? I saw some similar code in vitest's codebase. They were programmatically handling that case.
What do you think?
They were programmatically handling that case.
Can you share where they are doing that?
Here, https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/node/stdin.ts#L49-L68
But they seem to be using raw input mode. Can you also look around a bit and see if it's possible to use raw input mode.
Yeah, we specifically chose not to use raw input mode because then you have to manually handle all keyboard shortcuts for interrupting the process.
You were the one who made the initial PR weren't you? So you were a part of that conversation
Yeah I know, I'm not suggesting raw input mode. I'm pitching maybe we can do something for windows specifically. They also have OS specific code.
Oh I see, sorry yes, that makes sense. Though it means we have to manually handle an edge case, which I wanted to avoid :/
@nishu-murmu Did you ever explore older versions of WXT and find the version that introduced this behavior? I don't think I ever heard confirmation from anyone that v0.19.19 actually introduced this.
This is powershell terminal
https://www.loom.com/share/f914b2f34f994551b630b231708be473?sid=f9191019-8916-4064-b9e9-72fbd2df767b
Here is the tested video for version 0.19.18
It seems to be working fine.
After pressing Ctrl + C the powershell terminal is working fine.
But yeah pressing twice works.
Does the "-> wxt-demo" usually show up when asking to confirm stopping the process? I haven't used powershell in a while but previously, that prompt would show on its own line.
Yes, It shows up when asking for confirmation. This works fine initially. For any version. But doing this more than twice or thrice breaks the windows terminal https://www.loom.com/share/f914b2f34f994551b630b231708be473?sid=34c3b762-0b10-447f-9d9e-033fbbb074e9
Doesn't look like its work to me. When you type "Y", shouldn't it stop the process and give you a new blank line to type on? I understand that pressing Ctrl+C again makes it work, but you shouldn't have to press it again after typing "Y"
are there any solutions?
@ianho7 No. I should probably disable this feature on windows. I need someone with windows to contribute a working solution.
Ran into this issue, using cmd instead of powershell avoids this crash, I configured default terminal for my extension repository to be CMD via adding
"settings": {
"terminal.integrated.defaultProfile.windows": "Command Prompt"
}
to the .code-workspace file.
Terminating on windows with CTRL+C is nightmare.
If i terminated process then i hadn't able to rerun script, only i can do is close terminal and reopen it and then i'm able but not everytime sometime i have info buildc is running, waiting for finish or sth like that.
Also i have problem with terminate pnpm test it's probably worst than dev, because if i terminated then i hadn't able to rerun and i need to wait a while to all previous run ends.
https://github.com/user-attachments/assets/c844ced8-b819-44dc-a9f8-0a6f1891ec74
PS: I think it's issue with buildc package