Open Diggsey opened 8 years ago
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.
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:
msys-2.0.dll
/cygwin1.dll
%HOME%
, which will be C:\msys64\home\<username>
%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.
I didn't know about %CYGROOT%
/%MSYSROOT%
. I'll look into using those.
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.
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?
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.
Got it. I didn't realize Windows allowed dynamically loading libraries from the PATH at runtime (libraries like libloading expect a full path).
Hi there!
Bumped into this from the intelliJ rust plugin, any progress on this?
Cheers!
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.
Actually, Cargo recently migrated to termcolor
: https://github.com/rust-lang/cargo/pull/4162. So it soon should emit pure ANSI codes for windows, and that in theory should just work with IntelliJ.
Isn't this more about rustc error messages than cargo?
Hm, @Stebalien you are probably right! I wonder if it is desirable to remove terminfo parsing from rustc as well...
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.
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.