Giter Club home page Giter Club logo

Comments (10)

creationix avatar creationix commented on May 24, 2024

Thanks for the report!

How are you writing to stdout? Are you creating a new uv_tty_t and writing
to that or just calling lua's native print or io interface? (You can simply
post your lua if you want). Also how did you build for windows. I
haven't yet tried it. I get back home on Saturday night and can test on
windows next Monday.

On Thu, Oct 9, 2014 at 9:38 PM, George Zhao [email protected]
wrote:

tty not work on windows,(on version
https://github.com/luvit/luv/tree/uv-update-1.0.0)
output is

[0;34m1[0m [0;35muv_tcp_t: 0x000e8fe8[0m
[1;32m"[0;32mserver[1;32m"[0m [0;35muv_tcp_t: 0x000e8fe8[0m { ip =
[1;32m"[0;32m0.0.0.0[1;32m"[0m, family = [1;32m"[0;32mINET[1;32m"[0m, por
t = [0;34m2024[0m }


Reply to this email directly or view it on GitHub
#74.

from luv.

zhaozg avatar zhaozg commented on May 24, 2024

I just run luajit test/run.lua

from luv.

creationix avatar creationix commented on May 24, 2024

Ok, then it's my fault. I'm using the native print and sending unix color
escape codes manually in utils.lua. Libuv will convert these to proper
windows codes if you write through uv_tty_t. I'll update the samples and
tests to re-define print to go through libuv.

On Thu, Oct 9, 2014 at 9:42 PM, George Zhao [email protected]
wrote:

I just run luajit test/run.lua


Reply to this email directly or view it on GitHub
#74 (comment).

from luv.

imzyxwvu avatar imzyxwvu commented on May 24, 2024

Please do not translate them in libuv. When we want to pass binary data through tty stdio, that might causes problems. On Windows, there are some winapis such as SetConsoleTextAttribute to change colors, but not codes. So we should implement another library or use luajit ffi to filter escaping codes on Windows.

from luv.

rphillips avatar rphillips commented on May 24, 2024

That sounds reasonable. Turning off color output on windows and not changing anything else seems like a good fix for now.

from luv.

creationix avatar creationix commented on May 24, 2024

I won't be the one doing the translation. It's a feature of libuv which I'm binding. It's up to the lua code to use libuv tty for output or using lua's built-in IO functions.

from luv.

imzyxwvu avatar imzyxwvu commented on May 24, 2024

On Windows, we must filter the escape code self and change the color by calling the specified WINAPI. Both lua io library and libuv donot provide translating. @creationix please keep in mind Windows does not control the tty by escape codes.

from luv.

creationix avatar creationix commented on May 24, 2024

@imzyxwvu I'm well aware that windows does not know anything about ansi escape codes. Like I said before, this is a feature of libuv that many people find useful. The code can be found in https://github.com/joyent/libuv/blob/master/src/win/tty.c. Luv knows nothing about this but simply inherits the ability from libuv itself.

I know this feature works. I've used it in the past on node.js, luvit, and recently luvi on windows. Luvit redefines lua's print global to go through libuv's tty so that ansi color codes work on windows.

from luv.

creationix avatar creationix commented on May 24, 2024

@zhaozg does this fix colors for you in the repl example on windows? 8af4408

from luv.

zhaozg avatar zhaozg commented on May 24, 2024

Work fine. thanks. but test/run.lua can't pass

from luv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.