Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Text not printed with rprint without newline #75

Closed
jiayihu opened this issue Oct 13, 2020 · 4 comments · Fixed by #77
Closed

Text not printed with rprint without newline #75

jiayihu opened this issue Oct 13, 2020 · 4 comments · Fixed by #77

Comments

@jiayihu
Copy link

jiayihu commented Oct 13, 2020

I have a strange bug where rprint!(".") doesn't print anything until I print a newline \n later. For instance rprint!(".\n"); works, rprint!("."); rprint!("\n"); works too, and of course rprintln!("."); works. Characters are not missed, it's just as if some buffer is flushed only when newline is met.

This doesn't happen with cargo-embed so I created the issue here

@japaric
Copy link
Member

japaric commented Oct 19, 2020

Thanks for the report! Applications that print to the terminal will usually only flush after a newline. When --defmt is not used we should flush after each write to the stdout. So a flush after

stdout.write_all(&read_buf[..num_bytes_read])?;
should fix this issue.

japaric added a commit that referenced this issue Oct 19, 2020
terminal apps flush on newline by default (changing that is not straightforward
iirc)
so instead we flush after each write call so that data not containing a newline
is printed immediately
should fix #75
@japaric
Copy link
Member

japaric commented Oct 19, 2020

@jiayihu could you try the latest (git) version of probe-run and let us know if this was fixed?

Re-opening until we heard back from the author

@japaric japaric reopened this Oct 19, 2020
@japaric japaric added the type: question A question that isn't answered by the docs label Oct 19, 2020
@jiayihu
Copy link
Author

jiayihu commented Oct 20, 2020

Yeah works fine now and I think I'll stick with the git version, logs are prettier now 😄

@jiayihu jiayihu closed this as completed Oct 20, 2020
@japaric
Copy link
Member

japaric commented Oct 20, 2020

Thanks for confirming!

@japaric japaric removed the type: question A question that isn't answered by the docs label Oct 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants