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

Pressing Ctrl-C while executing a command in PowerShell Core closes tab #221

Closed
analogrelay opened this issue Mar 8, 2019 · 4 comments
Closed

Comments

@analogrelay
Copy link

analogrelay commented Mar 8, 2019

For some reason, when using PowerShell Core (pwsh.exe) in FluentTerminal, pressing Ctrl-C during a long-running command closes the entire tab.

  • This does not repro if I'm just sitting at a blank command prompt (no active PowerShell command)
  • This does not repro in pwsh.exe outside of FluentTerminal
  • This does not repro in powershell.exe (non-Core PowerShell) inside FluentTerminal

Here's a recording illustrating what I mean (using the on-screen keyboard to illustrate when Ctrl-C is pressed)

fluentterminal-ctrlc-reprovideo

It's odd that this only happens in pwsh.exe, perhaps there is some interaction between PowerShell Core and the console APIs that isn't properly handled here.

Let me know if I can help repro anything or get any more data! I'm a big fan of FluentTerminal so far, looking forward to seeing it develop!

@felixse
Copy link
Owner

felixse commented Mar 8, 2019

What version of pwsh are you using? I just tried the exact same with 6.1.3 but was not able to reproduce this in Fluent Terminal 0.3.1 or current master.

@analogrelay
Copy link
Author

It's 6.1.3 for me too. It's very possible it's something on my machine. Let me see if I can get a crash dump or something with more information.

@analogrelay
Copy link
Author

I figured it out! It's not FluentTerminal :). I also use "scoop" (a package manager for Windows) that creates shim exes for the programs that are installed. The issue only reproduces if that shim exe is used. If I use the path directly to the "real" exe, it works fine. I'll close this since it's not really a FluentTerminal issue, but have included my findings as a curiosity to anyone who finds this thread 😝

When using the pwsh.exe shim that scoop creates directly (not inside FluentTerminal) the issue does not repro, however the process tree shows two processes:

* [A] explorer.exe
 * [B] C:\Users\anurse\scoop\shims\pwsh.exe
  * [C] C:\Users\anurse\scoop\apps\pwsh\6.1.3\pwsh.exe

When Ctrl-C is pressed, process [B] (the shim) terminates. However, the actual PowerShell process (Process [C]) is still alive and is just orphaned.

However, when in FluentTerminal, the process tree is:

* [A] FluentTerminal.SystemTray.exe
 * [B] winpty-agent.exe
  * [C] C:\Users\anurse\scoop\shims\pwsh.exe
   * [D] C:\Users\anurse\scoop\apps\pwsh\6.1.3\pwsh.exe

When I perform the same action here, again it's process [C] (the shim) that terminates due to the Ctrl-C. However, it looks like something in that process tree (winpty, or FluentTerminal) terminates all the children (including process [D], the actual PowerShell process) when [C] terminates. This is sensible behavior, so I don't think that there's anything FluentTerminal should do differently here.

@f0ff886f
Copy link

Just as an FYI, there is a fix proposed in scoop for this (so that the shim won't cause such bad behaviour): ScoopInstaller/Scoop#3634

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