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

Ctrl-C can't stop windows processes #332

Open
Chronial opened this issue Jun 16, 2023 · 8 comments
Open

Ctrl-C can't stop windows processes #332

Chronial opened this issue Jun 16, 2023 · 8 comments

Comments

@Chronial
Copy link

Steps to reproduce:

  • Open a wsltty terminal
  • Run ping.exe localhost
  • Press ctrl-C

Expected outcome:

  • Ping is aborted

Actual outcome:

  • Nothing happens

wsltty version: 3.5.4
This happens with both wsl1 and wsl2
ctrl-c works with linux processes
ctrl-c works when running wsl inside the windows terminal.

@mintty
Copy link
Owner

mintty commented Jun 16, 2023

If you use WSL ping rather than Windows ping.exe, it works.
Anyway, this is not a terminal issue. The terminal just passes ^C to the pty driver as a normal key. It's the driver, then cygwin, and respectively layers of WSL vs Windows that continue handling. Therefore closing.

@mintty mintty closed this as completed Jun 16, 2023
@mintty
Copy link
Owner

mintty commented Jun 16, 2023

It might be possible to handle this in wslbridge however, therefore reopening. @Biswa96?

@mintty mintty reopened this Jun 16, 2023
@Biswa96
Copy link
Contributor

Biswa96 commented Jun 16, 2023

If I run wslbridge2.exe directly in CMD, then Ctrl+C works with ping.exe.

@Chronial
Copy link
Author

Anyway, this is not a terminal issue.

Wouldn't the fact that it works in windows terminal imply otherwise? Or are you saying this is a wslbridge issue?

If I run wslbridge2.exe directly in CMD, then Ctrl+C works with ping.exe.

Same here

@mintty
Copy link
Owner

mintty commented Jun 20, 2023

Anyway, this is not a terminal issue.

Wouldn't the fact that it works in windows terminal imply otherwise?

No, things are more subtle here.

Or are you saying this is a wslbridge issue?

Not quite sure, but wslbridge steps in at the pty level and could propagate special handling to the WSL backend.

@Chronial
Copy link
Author

Chronial commented Jun 20, 2023

Interestingly, running wslbridge in wsltty and ping.exe inside wslbridge makes Ctrl-C work again.
At same time, running tmux inside CMD and ping.exe in there breaks Ctrl-C.

Doesn't Work

cmd → wsl → tmux → ping.exe
wsltty → ping.exe
wsltty → tmux → ping.exe

Works

cmd → wsl → ping.exe
cmd → wslbridge ping.exe
wsltty → wslbridge ping.exe
wsltty → tmux → wslbridge ping.exe
wsltty → wslbridge → tmux → ping.exe

Long story short: Manually running wslbridge as the root process inside wsltty makes everything work correctly. But I thought that's what wsltty was doing already? Something seems wrong here.

@mintty
Copy link
Owner

mintty commented Jun 20, 2023

Manually running wslbridge as the root process inside wsltty make everything work correctly.

Which means exactly what? Changed the shortcut?

But I thought that's what wsltty was doing already? Something seems wrong here.

Yes, puzzled what you are doing.

@Chronial
Copy link
Author

Start wsltty, run ping.exe localhost, press ctrl-C -> no effect.
Start wsltty, run wslbridge2.exe, run ping.exe localhost, press ctrl-C -> works

I am confused because wsltty seems to be running wslbridge already, so it's surprising to me that a second layer of wslbridge fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants