Add option --no-tty-restore / -N that omits tty_restore() call#348
Open
ErlingSigurdson wants to merge 2 commits into
Open
Add option --no-tty-restore / -N that omits tty_restore() call#348ErlingSigurdson wants to merge 2 commits into
ErlingSigurdson wants to merge 2 commits into
Conversation
…to tty_restore().
Author
|
@lundmar, fröhliche Weihnachten! |
Author
|
Updated AUTHORS as per @sly74fr's recommendation. |
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 is an attempt to address this issue: #334
Unfortunately, for now I've found the only reliable way to allow non-interactive transmissions actually finish (not just clear the buffer, but let the data reach its destination before TTY settings get restored): dismiss the
atexit(&tty_restore)call. In order to avoid messing with the baseline execution flow, I decided to make it an option, not a mainstream.Experiments with
tcdrain(),tcsetattr(..., TCSADRAIN, ...),tcflow()andioctl(device_fd, TIOCOUTQ, &...)didn't bring any useful result.That being said, even this way isn't 100% reliable: when using
--no-tty-restore/-Nin non-interactive mode, my data reaches the TTY device (CH340 chip in my case) only starting from second attempt (not EVERY second attempt, it's just that the first attempt always fails, but subsequent ones are always successful).I tried to comply with your code style and option documentation as hard as I could.
Best regards for FOSS crowd.