Comments (9)
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.
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.
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.
(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.
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.
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.
@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.
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.
@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)
- Check isatty == false before coloring HOT 11
- tag version v0.4.0? HOT 2
- How to fall back on std::io::stderr() if term::stderr() fails? HOT 8
- Better MSYS2 support HOT 14
- WinConsole's tty check is inaccurate HOT 1
- All Terminal methods leak memory on Windows HOT 7
- Use `el` not `dl` to erase a line?
- How to store and pass around `Terminal` of any type. HOT 3
- `Terminal` should probably buffer
- panic with operation not supported by the terminal while libterm works fine HOT 3
- Term crashes on FreeBSD HOT 7
- No output to stdout when no TTY attached in Docker container HOT 2
- term::stdout() returns None unexpectedly HOT 3
- terminfo problem while using rogcat HOT 2
- Write plain text when running under a start/stop daemon like systemd ?
- [LFM] Looking For Maintainer HOT 11
- Last release was in February 2018 HOT 1
- Please relase a new version HOT 3
- Switch winapi dependency to windows/windows-sys HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from term.