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

Track exclusive usage of stdout/stderr, or have a singleton for them #7

Open
sourcefrog opened this issue Oct 15, 2022 · 0 comments
Open

Comments

@sourcefrog
Copy link
Owner

It only ever makes sense for one View to be drawing to stdout or stderr at any time. If there's more than one, they'll probably scramble the screen state.

At the moment the application is responsible for at most one View being active at any time.

We could, instead, for example, panic if more than one View is in use. Or, perhaps, one of them should take over responsibility, leaving the others suspended. Or even, perhaps, they should all be drawn at the same time? That does get complicated if they're using different options.

It's OK for any number of captured views to be in use, and indeed necessary for Nutmeg's own test suite.

However, this might be complicated if Views are used during a program's test suite. Because of the way Rust's test suite captures println! they won't actually conflict. I'm not sure if this is directly detectable.

If this is done and we have a clear picture which View is active, that enables providing a write() or write_stderr() that sends text through the progress bar if there is one, or otherwise directly to stdout or stderr. There could even be a nutmeg::println!() that coordinates with whichever bar. This also opens the door to built in tracing integration.

@sourcefrog sourcefrog changed the title Track exclusive usage of stdout/stderr Track exclusive usage of stdout/stderr, or have a singleton for them Oct 19, 2022
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

1 participant