Skip to content

Conversation

@nu774
Copy link
Contributor

@nu774 nu774 commented Dec 16, 2013

This fixes somewhat jumbled output due to mixed usage of stdout and
stderr without proper calls to fflush() and letting stdio choose the
default buffering strategy.
On win32, pipes are often used instead pty (since there's no pty on win32),
therefore this issue has higher possibility to appear. For example,
running scanner in psuedo terminal application such as mintty is
enough to reproduce the issue.
unbuffered mode is a simple way to ensure output order to be
always preserved, at the expence of tiny I/O overhead that should be
negligible.

This fixes somewhat jumbled output due to mixed usage of stdout and
stderr without proper calls to fflush() and letting stdio choose the
default buffering strategy.
On win32, pipes are often used instead pty (since there's no pty on win32),
therefore this issue has higher possibility to appear. For example,
running scanner in psuedo terminal application such as mintty is
enough to reproduce the issue.
unbuffered mode is a simple way to ensure output order to be
always preserved, at the expence of tiny I/O overhead that should be
negligible.
@nu774
Copy link
Contributor Author

nu774 commented Dec 16, 2013

Sorry, don't merge this patch.
It turned out that simply setting unbuffered mode causes problem due to multithreading.
Since MSVC doesn't support line buffered mode, we cannot rely on it, too.

@nu774 nu774 closed this Dec 16, 2013
@nu774
Copy link
Contributor Author

nu774 commented Dec 16, 2013

Hmm, sorry again. The previous comment seems my mistake (was testing with wrong branch..), it works here.

@nu774 nu774 reopened this Dec 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant