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

stdout/stderr desync in script mode #6

Open
mitsuhiko opened this issue Dec 25, 2022 · 1 comment
Open

stdout/stderr desync in script mode #6

mitsuhiko opened this issue Dec 25, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@mitsuhiko
Copy link
Owner

Today stderr and stdout end up highly desynchronized if they are used in script mode. I believe that this is generally an unsolvable issue however faketty does not appear to have this issue despite it having separate streams. I believe that the fact that stderr appears as a tty there changes something in how tools print.

@mitsuhiko mitsuhiko added the enhancement New feature or request label Dec 25, 2022
@mitsuhiko
Copy link
Owner Author

I tried to swap out pipe() with openpty() for script mode but by itself that doesn't do anything. I think the main reason why faketty appears to be able to synchronize the streams is that it doesn't do any select() or similar. Hooking some debug prints in, the two lines from stdout appear in the same flush as the one line from stderr in my test script. I think if I were not to select but have a separate thread to try to funnel stdout to stdout and stderr to stderr as quickly as possible they might appear synchronized. I am however not sure that this is going to reliably fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant