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

Implement ExternalPrinterWriter #798

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

xeruf
Copy link

@xeruf xeruf commented Aug 23, 2024

To enable duplex output of log messages

Fixes #797

To enable duplex output of log messages

Fixes kkawakam#797
@xeruf
Copy link
Author

xeruf commented Aug 23, 2024

Only Problem: When rustyline logs at debug level, the prompt somehow does not work. Fixed in my project by .filter(Some("rustyline"), LevelFilter::Warn)

@gwenn
Copy link
Collaborator

gwenn commented Aug 23, 2024

I am afraid that on incomplete / partial write, rustyline is going to append newline (\n) where they are not expected.
See

rustyline/src/edit.rs

Lines 324 to 326 in e4eca97

if !msg.ends_with('\n') {
self.out.write_and_flush("\n")?;
}

@xeruf
Copy link
Author

xeruf commented Aug 23, 2024

That is why the method was called println in the rustylinez fork, but that is not the main problem even though it is not quite ideal.
The readline function completely hangs when at debug level for rustyline, probably they somehow interfere with each other.

@gwenn
Copy link
Collaborator

gwenn commented Aug 24, 2024

Indeed, it should be named println.
But initially, there was no newline appended automatically until:
#629
#627

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.

Implement Write for external printer
2 participants