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

Allow colored output on MinTTY consoles on Windows #3643

Merged
merged 2 commits into from
Feb 1, 2017
Merged

Allow colored output on MinTTY consoles on Windows #3643

merged 2 commits into from
Feb 1, 2017

Conversation

RyanGlScott
Copy link
Contributor

Currently, the Idris REPL doesn't print colored output when you run it in a MinTTY console like Cygwin or MSYS:

idris-1

This makes me sad.

The reason this happens is because due to a quirk in the way MinTTY, calling isATTY in it will always return False. But we shouldn't just use isATTY to determine if we're in a console that supports colors! We can detect the presence of MinTTY pretty reliably by inspecting the file descriptor that MinTTY uses for its standard output. The minimalist mintty library accomplishes this, so I've added a dependency on it.

Now we can have colored output on MinTTY:

idris-2

Yay!

@Melvar
Copy link
Collaborator

Melvar commented Jan 31, 2017

Is this not a bug in the other software?

@RyanGlScott
Copy link
Contributor Author

The fact that isatty doesn't work on MinTTY is something which the maintainer has declared as wontfix.

GHC has to work around this too by employing the same trick.

@melted
Copy link
Contributor

melted commented Jan 31, 2017

Travis was just a time-out. Restarted that job.

@melted
Copy link
Contributor

melted commented Jan 31, 2017

@Melvar It's a quirk, if it's nothing much we can accommodate those. Like with the nixOS hashbang.

@RyanGlScott It would be nice if the check could be folded into the tty check in Util/System.hs, so it doesn't leak into Main.hs and Output.hs.

@RyanGlScott
Copy link
Contributor Author

@melted, good idea, done.

@melted
Copy link
Contributor

melted commented Feb 1, 2017

Thanks for the PR!

@melted melted merged commit b6e1a8c into idris-lang:master Feb 1, 2017
@jfdm
Copy link
Contributor

jfdm commented Feb 3, 2017

I think this user facing change should be mentioned in the CHANGELOG. Please can it be updated.

@RyanGlScott
Copy link
Contributor Author

@jfdm, oops, that totally slipped my mind. I've opened #3648 to atone. :)

ahmadsalim pushed a commit that referenced this pull request Feb 3, 2017
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

Successfully merging this pull request may close these issues.

4 participants