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

Crashes in git bash #22

Open
andrejohansson opened this issue Apr 18, 2018 · 8 comments
Open

Crashes in git bash #22

andrejohansson opened this issue Apr 18, 2018 · 8 comments

Comments

@andrejohansson
Copy link

Maybe its expected since it´s not written any support, but it could be good to know that it doesnt work in git bash on windows, it fails:
Unhandled Exception: System.IO.IOException: The handle is invalid.

Splendid lib otherwise :-)

@theamazingfedex
Copy link

I have the same issue. At least I'm not alone :) Does @Mpdreamz plan to include Git Bash for Windows support in the future?

@dlech
Copy link
Collaborator

dlech commented Jul 31, 2018

What runtime are you using?

I tested this with .NET Core 2.1.0 and it does crash. I don't think this can be fixed in this library though. I think it needs to be fixed in dotnet/corefx. The problem is that System.Console is trying to use Windows APIs on a unix terminal emulator.

Here is the full stack trace for reference.

$ dotnet run -p src/ShellProgressBar.Example/

Unhandled Exception: System.IO.IOException: The handle is invalid
   at System.ConsolePal.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
   at System.ConsolePal.Clear()
   at System.Console.Clear()
   at ShellProgressBar.Example.Program.RunTestCases(CancellationToken token) in C:\Users\david\Documents\GitHub\shellprogressbar\src\ShellProgressBar.Example\Program.cs:line 95
   at ShellProgressBar.Example.Program.MainAsync(String[] args, CancellationToken token) in C:\Users\david\Documents\GitHub\shellprogressbar\src\ShellProgressBar.Example\Program.cs:line 57
   at ShellProgressBar.Example.Program.Main(String[] args) in C:\Users\david\Documents\GitHub\shellprogressbar\src\ShellProgressBar.Example\Program.cs:line 48

I rarely use windows, so I'm not interested in perusing a fix here, but I think it should be possible for System.Console to try to detect if it is running on a non-windows terminal and try to use System.ConsolePal.Unix instead.

@jakehockey10
Copy link

I'm seeing this same error while using the Powershell terminal in VS Code. Does that change the assessment of this issue?

@Mpdreamz
Copy link
Owner

Please try: https://www.nuget.org/packages/ShellProgressBar/4.1.1 it works for me in the Bash on Windows terminal.

@jamesrom
Copy link

@Mpdreamz, this issue still occurs when using Visual Studio Code. Tested with 4.1.1.

@Mpdreamz
Copy link
Owner

@jamesrom what operation system do you use?

@jamesrom
Copy link

@Mpdreamz, VS Code on Windows 10.

@sakennedy
Copy link

sakennedy commented Mar 25, 2020

I was running into this issue with Version 5.0.0. Turns out that it was an issue in Visual Studio Code and its built in terminal. See: dotnet/vscode-csharp#2336

Using 'externalTerminal' in Visual Studio Code launch settings resolved this for me.

"configurations": [ { "name": ".NET Core Launch (console)", "type": "coreclr", "request": "launch", ... "console": "externalTerminal" },

NOTE: I don't know how to stop github collapsing code blocks.

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

7 participants