Git Product home page Git Product logo

Comments (9)

BurntSushi avatar BurntSushi commented on September 2, 2024

For the time being, I ended up just implementing Terminal with my own type. That allowed me to move forward. See: https://github.com/BurntSushi/xrep/blob/2bda77c414d113b3640b372afffc781a2fe56e6d/src/terminal.rs

from term.

Stebalien avatar Stebalien commented on September 2, 2024

Actually, I've been trying to make a new interface that acts more like std::io::stdin. That is, just have a global "terminal" (although I'd still probably have a way for users to create "mock" terminals for testing). Now that I've submitted my thesis, I'm actually going to make a serious attempt at tackling this. It's not so straight forward because I'd like to support per-thread buffering to avoid crappy interleaved output.

from term.

BurntSushi avatar BurntSushi commented on September 2, 2024

My particular pattern is, "write output to a String in memory, then later output that String to stdout." Would your revisions still support that?

from term.

BurntSushi avatar BurntSushi commented on September 2, 2024

(Specifically, I need a way to write the output of some work without having to do synchronization on each call to print something. I'm happy to trade the memory required to do it.)

from term.

Stebalien avatar Stebalien commented on September 2, 2024

One of the feature's I'm working on is the ability to create fully buffered terminal handles that flush on drop. This way, one can build up a nice colored message and have it displayed all at once instead of getting interleaved with messages from other threads.

from term.

mooman219 avatar mooman219 commented on September 2, 2024

Would like to hop on this issue with getting Sync support on StdoutTerminal since it's along the same lines of multithreaded support. I wanted color support in a simple logger and it needed to be Send + Sync. A workaround is just wrapping it in a mutex but that's really overkill.

from term.

BurntSushi avatar BurntSushi commented on September 2, 2024

@mooman219 I don't think making StdoutTerminal be Sync is related to the specific problem in this ticket, and if one did make it Sync, I imagine it would use a mutex internally anyway. See how Stdout is handled in the standard library, for example.

from term.

Stebalien avatar Stebalien commented on September 2, 2024

I wouldn't make it Sync. Instead, I'd make creating multiple terminal "handles" cheep. Unfortunately, every time I approach this project, I get stumped trying to figure out the best way to do this on Windows. Ideally, I'd like multi-process programs like cargo to not miscolor error messages.

from term.

mooman219 avatar mooman219 commented on September 2, 2024

@BurntSushi Apologies, it felt like it fit under the title and didn't want to little issues on here.

@Stebalien Sounds good to me! I'm quite extremely new to Rust and have been battling it on concurrency lately.

from term.

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.