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

Proper support for Windows #70

Closed
3 tasks done
sharkdp opened this issue Oct 4, 2017 · 12 comments
Closed
3 tasks done

Proper support for Windows #70

sharkdp opened this issue Oct 4, 2017 · 12 comments

Comments

@sharkdp
Copy link
Owner

sharkdp commented Oct 4, 2017

There are a few things that need to be updated:

  • Proper handling of absolute paths (such as C:\users\...)
  • Ability to specify a search path.
  • Colored output

If the first two are fixed, we should be able to activate all tests that are currently disabled on Windows:

fd/tests/tests.rs

Lines 42 to 43 in 2403ac3

// TODO: Fails on windows
#[cfg_attr(windows, ignore)]

Concerning point 3:

  • I guess there is no analog to LS_COLORS, so we can only fall back to the defaults (see Default implementation of LsColors). This should work already.
  • Apparently, PowerShell is able to interpret ANSI escape sequences. However, I'm not sure how to configure it to do so.
  • If this is not possible, a solution would be to use termcolor. Currently, there is no support for 256 colors, so I'd like to keep using ansi_term on Linux/OSX - at least until there is progress on this PR. If this turns out to be too complicated, we could also disable colored output by default (on Windows).
sharkdp added a commit that referenced this issue Oct 7, 2017
* Use easier way to convert path components
* Fix failing tests on Windows
@sharkdp
Copy link
Owner Author

sharkdp commented Oct 7, 2017

Colors actually work fine on Windows 10 / Powershell:

image

@sharkdp sharkdp closed this as completed Oct 7, 2017
@Detegr
Copy link
Contributor

Detegr commented Oct 7, 2017

Powershell works fine, cmd.exe does not. I think we should either disable the coloring when the output is windows console or use termcolor to color the output if it is going to the windows console.

I'm not sure if it is possible to detect whether the output is going to powershell or cmd, so one option would be just use termcolor on Windows as you suggested earlier.

@sharkdp
Copy link
Owner Author

sharkdp commented Oct 7, 2017

I'm not sure if it is possible to detect whether the output is going to powershell or cmd

that would be one option. Maybe there is some kind of environment variable that is only set in PowerShell/cmd.exe.

so one option would be just use termcolor on Windows as you suggested earlier.

This way, we would actually loose support for 256 colors on Windows/PowerShell, which I would think is the default for people that are actually using the command line on Windows (?)

@Detegr
Copy link
Contributor

Detegr commented Oct 7, 2017

This way, we would actually loose support for 256 colors on Windows/PowerShell

True, but I would like to think termcolor will eventually support 256 colors and this would no longer be an issue. I think it also would be better to support some colors on both consoles on Windows than to support no colors at all.

@sharkdp
Copy link
Owner Author

sharkdp commented Oct 7, 2017

Somehow, I would like to get a feeling on how many people there are that actually do serious work in cmd.exe (serious in the sense that they are willing to install something like fd to improve their command line experience).

If there is such a user base, I'd be willing to work on that. Feel free to open a new ticket concerning termcolor support.

@sharkdp
Copy link
Owner Author

sharkdp commented Oct 8, 2017

Actually, there seems to be some work on this here: https://docs.rs/clicolors-control/0.1.0/clicolors_control/

@ofek
Copy link

ofek commented Oct 9, 2017

@sharkdp Will no. 1 be in the next release? I currently get 2 extra path separators after the drive e.g. C:\\\Users\Ofek\Desktop\....

@sharkdp
Copy link
Owner Author

sharkdp commented Oct 10, 2017

Will no. 1 be in the next release

Absolute path handling for Windows was added in v4.0.0.

I currently get 2 extra path separators after the drive e.g. C:\\Users\Ofek\Desktop....

Path handling on Windows is much more difficult than on Unix systems. The absolute path that is displayed is generated by fs::canonicalize and I already had a few issues with the results.

I know it's not pretty, but does C:\\\Users\... work as a valid path under Windows?

@ofek
Copy link

ofek commented Oct 10, 2017

No

capture

@sharkdp
Copy link
Owner Author

sharkdp commented Oct 10, 2017

Ok, in this case it looks like a bug. It would be great if you could open a new ticket to discuss this.

@ofek
Copy link

ofek commented Oct 10, 2017

@sharkdp
Copy link
Owner Author

sharkdp commented Oct 10, 2017

No, here (I guess 😄).Thanks!

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

3 participants