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

Error: Initial console modes not set on Windows #660

Closed
fujiapple852 opened this issue May 4, 2022 · 7 comments
Closed

Error: Initial console modes not set on Windows #660

fujiapple852 opened this issue May 4, 2022 · 7 comments

Comments

@fujiapple852
Copy link

fujiapple852 commented May 4, 2022

Describe the bug
Receive the error Error: Initial console modes not set when attempting to test trippy on Windows.

The error seems to originate from windows.rs which states:

Returns the original console color, make sure to call init_console_color before calling this function. Otherwise this function will panic.

So presumably init_console_color isn't being called. I'm unsure if this is something application code should be invoking (on Windows) or whether it is an internal API within crossterm.

When I run the tool I observe no output at all and it is only when I exit the tool that the screen renders and the error occurs.

To Reproduce
See the steps outlined here.

OS
Windows 10 from AWS WorkSpaces, bundle "Standard with Windows 10 (Server 2019 based) (WSP)"

Terminal/Console
Observed on Windows console (cmd.exe) and also in Powershell

@TimonPost
Copy link
Member

This error is given when init_original_console_mode is not called. This is called when you enable mouse capture (EnableMouseCaputre). It should only give this error if your calling DiableMouseCapture while you've never enabled it. Could that be right?

@fujiapple852
Copy link
Author

fujiapple852 commented May 4, 2022

@TimonPost that looks to be the case: https://github.com/fujiapple852/trippy/blob/master/src/frontend.rs#L181

I've made the fix (fujiapple852/trippy#116) and will retest and report back.

Thanks!

@fujiapple852
Copy link
Author

fujiapple852 commented May 5, 2022

@TimonPost I've re-tested and can confirm that the error no longer occurs and so this can be closed, thanks again.

There is still the other issue I mentioned, that the app doesn't display anything at all (completely blank terminal screen) after it starts until the application exits, at which point the final state of the app is displayed.

In general, should I expect crossterm to work on the OS/terminal combinations I mentioned above? If so I'll raise this as a separate issue (I tried the tui-rs demo app and observed the same problem which makes me think I'm using a OS/terminal combination that isn't supported). I don't have a local Windows machine to test with sadly.

@TimonPost
Copy link
Member

What terminal modes are you in? Did you enable raw modes/alternate screen?

@fujiapple852
Copy link
Author

@TimonPost to rule out all other variables I just retested with the crossterm interactive-demo.

I spun up a fresh AWS WorkSpaces machine (bundle Performance with Windows 10 (Server 2019 based) (WSP)), installed git, rust and the MS build tools and the proceeded to build and run the demo.

Here is a video of what I see, which is consistent with what I saw from tui-rs and my own app:

crossterm

Specifically, when the app starts, the screen clears and remains blank until you exit the app (I pressed 'q' after a few seconds) at which point the final state of the screen is shown.

I see the same thing for both Powershell and the cmd.exe.

@TimonPost
Copy link
Member

TimonPost commented Jul 2, 2022

I think this has to do with you connecting to the AWS machine. I am not sure why it works but never tried that out. I close this issue since the original issue was fixed. Feel free to open another one for AWS support.

@fujiapple852
Copy link
Author

Thanks @TimonPost. For the record I had better luck with Azure’s hosted Windows offering so I switched to that.

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

2 participants