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

Revert System.Console.OutputEncoding to not break the shell #1461

Closed
inosik opened this issue Jan 25, 2017 · 3 comments
Closed

Revert System.Console.OutputEncoding to not break the shell #1461

inosik opened this issue Jan 25, 2017 · 3 comments

Comments

@inosik
Copy link
Contributor

inosik commented Jan 25, 2017

Description

When using any external tool from a FAKE script (MSBuild, test runners, Paket, …), after FAKE exits, the terminal is broken. I tried different console emulators (Windows console, PowerShell, ConsoleZ) and different shells (cmd.exe, PowerShell, bash), and all show the same behavior.

Repro steps

  1. Open a cmd.exe window.

  2. Run FAKE with a target which invokes an external tool.

As I found out, the assignment of the output encoding before starting the process is the problem. The assigned value remains set after FAKE exits, which apparently breaks the input handling of the shell.

Actual behavior

After FAKE exits, I can't use the German Umlaut-characters. When I try to type an "Ä" for example, it doesn't appear on the screen, but now I'm able to delete already printed output from the console.

I reproduced this with fsi:

Screencast

Known workarounds

Use FAKE in its own terminal window.

Related information

  • Operating system: Windows 7
  • .NET Runtime, CoreCLR or Mono Version: .NET 4.6.2
@inosik
Copy link
Contributor Author

inosik commented Jan 26, 2017

Changing back to ibm850 encoding with chcp 850 after running FAKE seems to fix this. But maybe FAKE should restore the old encoding?

@matthid
Copy link
Member

matthid commented May 1, 2017

Thanks for this! I noticed this several times in the past as well. In fact this is probably why I use git bash mostly (which doesn't seem to have this problem). I never managed to reproduce this or find the reason :)

@inosik
Copy link
Contributor Author

inosik commented May 1, 2017

In fact this is probably why I use git bash mostly (which doesn't seem to have this problem).

I use the Git Bash most of the time, too, but that doesn't make any difference to me. The only terminal I tried, which doesn't seem to have this problem, is Hyper.

@matthid matthid changed the title Running external tools breaks console Revert System.Console.OutputEncoding to not break the shell May 7, 2017
inosik added a commit to inosik/FAKE that referenced this issue May 24, 2017
inosik added a commit to inosik/FAKE that referenced this issue May 24, 2017
inosik added a commit to inosik/FAKE that referenced this issue Jun 7, 2017
matthid added a commit that referenced this issue Jun 11, 2017
…ding-with-netcore

[WIP] Restore the output encoding
inosik added a commit to inosik/FAKE that referenced this issue Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants