Fix line endings in menu display output#3473
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3473 +/- ##
=======================================
Coverage 61.84% 61.84%
=======================================
Files 637 637
Lines 43121 43124 +3
=======================================
+ Hits 26667 26672 +5
+ Misses 16454 16452 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This was committed before but accidentally included in a revert of
another change. On some kinds of output (specifically serial ports)
you need to move the 'cursor' back to the left hand side of the
screen.
Otherwise
it tends to
look a bit like
stairs
Signed-off-by: jelischer <58259690+jelischer@users.noreply.github.com>
Under some environments the fact that the menu actually switches form stdio to /dev/tty in the middle of processing actually matters. This is done because in some environments the stdio devices don't really handle input timeouts well, but the downside is that they can be two very different data paths. When the file descriptor used for the prompt is put into raw mode the buffering in the other file descriptor is not notified so any data not flushed out remains unflushed. The end result is that the prompt, sent out last can show up on the screen at almost any place from the top to the bottom. Since we can't just use the stdout device (if we trust the comments that say that we can't) then the only other option is to force a flush on all the data sent before the prompt (and throw in a tiny delay for safety). Fixes: u-root#3426 Signed-off-by: jelischer <58259690+jelischer@users.noreply.github.com>
Contributor
Author
|
Here is another attempt to fix this issue.. this time I think we can do it without triggering the broken tests |
AjanZhong
approved these changes
Dec 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was committed before but accidentally included in a revert of another change. On some kinds of output (specifically serial ports) you need to move the 'cursor' back to the left hand side of the screen.
Due to a different bug in the same code, the line for the prompt and the lines for the menu items can get intermixes in almost any order due to the fact that two different file descriptors are used for a single stream of data.
There are reasons for this but one needs to make sure that one stream is properly flushed out before the other starts sending data or hilarity ensues.
Signed-off-by: jelischer 58259690+jelischer@users.noreply.github.com