wxt icon indicating copy to clipboard operation
wxt copied to clipboard

windows terminal breaks on `ctrl+C`

Open aklinker1 opened this issue 1 year ago • 14 comments

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

aklinker1 avatar Dec 14 '24 05:12 aklinker1

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 avatar Dec 16 '24 12:12 nishu-murmu

@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 avatar Dec 17 '24 18:12 aklinker1

@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. open-source

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?

nishu-murmu avatar Dec 17 '24 18:12 nishu-murmu

They were programmatically handling that case.

Can you share where they are doing that?

aklinker1 avatar Dec 18 '24 00:12 aklinker1

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.

nishu-murmu avatar Dec 18 '24 11:12 nishu-murmu

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

aklinker1 avatar Dec 18 '24 14:12 aklinker1

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.

nishu-murmu avatar Dec 18 '24 18:12 nishu-murmu

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.

aklinker1 avatar Dec 19 '24 21:12 aklinker1

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.

nishu-murmu avatar Dec 20 '24 13:12 nishu-murmu

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.

aklinker1 avatar Dec 20 '24 18:12 aklinker1

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

nishu-murmu avatar Dec 23 '24 10:12 nishu-murmu

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"

aklinker1 avatar Dec 23 '24 14:12 aklinker1

are there any solutions?

ianho7 avatar Feb 06 '25 12:02 ianho7

@ianho7 No. I should probably disable this feature on windows. I need someone with windows to contribute a working solution.

aklinker1 avatar Feb 12 '25 06:02 aklinker1

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.

GunsyX avatar Jun 04 '25 18:06 GunsyX

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

PatrykKuniczak avatar Jul 05 '25 11:07 PatrykKuniczak