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

Better MSYS2 support #58

Open
Diggsey opened this issue Feb 27, 2016 · 14 comments
Open

Better MSYS2 support #58

Diggsey opened this issue Feb 27, 2016 · 14 comments

Comments

@Diggsey
Copy link

Diggsey commented Feb 27, 2016

Currently only a very minimal set of operations are supported on mys2/cygwin, because it always falls back to msys_terminfo.

However, if it looked in the right place, it would be able to find and parse the correct terminfo: the problem is that it only searches unix-style paths (eg. /usr/share/terminfo) which are not valid for a native windows program.

On windows, it should convert these paths by calling cygpath -w /usr/share/terminfo before it tries to search them. With that modification the additional terminal features should just work.

@Stebalien
Copy link
Owner

I'm not calling an external binary on any platform. Currently, the best solution is to set the TERMINFO environment variable (see the README). I'm also considering pre-parsing some terminfo databases and including them in term.

@Diggsey
Copy link
Author

Diggsey commented Feb 27, 2016

I don't consider requiring manual intervention by the end-user to be a solution, let alone the best solution.

If you are averse to running an external binary, there are a number of other ways to get cygroot:

  • Call the path conversion function directly from msys-2.0.dll/cygwin1.dll
  • Use one of the environment variables, for example you can easily figure out the root directory from %HOME%, which will be C:\msys64\home\<username>
  • Use the %CYGROOT%/%MSYSROOT% environment variables, falling back to C:\msys64 or C:\cygwin if they don't exist. (This is probably the best option)

Having some common terminfo's built-in would be a good fallback.

@Stebalien
Copy link
Owner

I didn't know about %CYGROOT%/%MSYSROOT%. I'll look into using those.

@Diggsey
Copy link
Author

Diggsey commented Feb 27, 2016

The problem is that they're not set by the official installer - they're set if you install through some alternative ways, such as via chocolatey, so if you installed to a custom directory that's not C:\msys64, you'd have to set them manually.

@Stebalien
Copy link
Owner

Link for future reference: https://cygwin.com/cygwin-api/func-cygwin-conv-path.html

Dynamically loading cygwin1.dll/msys-2.0.dll might be the way to go. Do you know how one finds DLLs on windows?

@Diggsey
Copy link
Author

Diggsey commented Feb 27, 2016

You shouldn't need to find them - if the program is run from an msys or cygwin shell then they'll be on the PATH already.

@Stebalien
Copy link
Owner

Got it. I didn't realize Windows allowed dynamically loading libraries from the PATH at runtime (libraries like libloading expect a full path).

@Geobert
Copy link

Geobert commented Jul 31, 2017

Hi there!

Bumped into this from the intelliJ rust plugin, any progress on this?

Cheers!

@Stebalien
Copy link
Owner

Unfortunately, not really; I don't really have time to learn low-level Windows stuff at the moment. term now has decent support for fallback terminals when $TERM is known but the terminfo database can't be found (so coloring should work) but that's it.

@matklad
Copy link

matklad commented Aug 16, 2017

Actually, Cargo recently migrated to termcolor: rust-lang/cargo#4162. So it soon should emit pure ANSI codes for windows, and that in theory should just work with IntelliJ.

@Stebalien
Copy link
Owner

Isn't this more about rustc error messages than cargo?

@matklad
Copy link

matklad commented Aug 16, 2017

Hm, @Stebalien you are probably right! I wonder if it is desirable to remove terminfo parsing from rustc as well...

@Stebalien
Copy link
Owner

Given fallback terminals, removing terminfo parsing shouldn't be an issue (although that create has a much nicer interface than this one...).

Actually, IMO, the terminfo parser is the one part of this crate that's really worth saving. The pretty-printing API is not fun to use.

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

5 participants