Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows terminal breaks on ctrl+C #1279

Open
5 tasks done
aklinker1 opened this issue Dec 14, 2024 · 12 comments
Open
5 tasks done

windows terminal breaks on ctrl+C #1279

aklinker1 opened this issue Dec 14, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@aklinker1
Copy link
Collaborator

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 aklinker1 added the bug Something isn't working label Dec 14, 2024
@nishu-murmu
Copy link
Contributor

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.

@aklinker1
Copy link
Collaborator Author

aklinker1 commented Dec 17, 2024

@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?

@nishu-murmu
Copy link
Contributor

@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?

@aklinker1
Copy link
Collaborator Author

They were programmatically handling that case.

Can you share where they are doing that?

@nishu-murmu
Copy link
Contributor

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.

@aklinker1
Copy link
Collaborator Author

aklinker1 commented Dec 18, 2024

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

@nishu-murmu
Copy link
Contributor

nishu-murmu commented Dec 18, 2024

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.

@aklinker1
Copy link
Collaborator Author

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.

@nishu-murmu
Copy link
Contributor

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.

@aklinker1
Copy link
Collaborator Author

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.

@nishu-murmu
Copy link
Contributor

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

@aklinker1
Copy link
Collaborator Author

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants