Skip to content

Add option --no-tty-restore / -N that omits tty_restore() call#348

Open
ErlingSigurdson wants to merge 2 commits into
tio:masterfrom
ErlingSigurdson:no-tty-restore
Open

Add option --no-tty-restore / -N that omits tty_restore() call#348
ErlingSigurdson wants to merge 2 commits into
tio:masterfrom
ErlingSigurdson:no-tty-restore

Conversation

@ErlingSigurdson

Copy link
Copy Markdown

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() and ioctl(device_fd, TIOCOUTQ, &...) didn't bring any useful result.

That being said, even this way isn't 100% reliable: when using --no-tty-restore / -N in 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.

@ErlingSigurdson

Copy link
Copy Markdown
Author

@lundmar, fröhliche Weihnachten!

@ErlingSigurdson

Copy link
Copy Markdown
Author

Updated AUTHORS as per @sly74fr's recommendation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant