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

Flush stdout when needed #39

Merged
merged 1 commit into from
Feb 8, 2021
Merged

Flush stdout when needed #39

merged 1 commit into from
Feb 8, 2021

Conversation

kabiroberai
Copy link
Contributor

This fixes a bug on certain machines (eg the iSH emulator on iOS), where the output of commands and/or the prompt wouldn't be printed correctly.

Before:

Kabirs-iPhone:~# mcrcon -H <HOST> -p <PASS>
Logged in. Type 'quit' or 'exit' to quit.
say hi
list
>>There are 0 of a max 20 players online: 
^C>Kabirs-iPhone:~#

After:

Kabirs-iPhone:~# mcrcon -H <HOST> -p <PASS>
Logged in. Type 'quit' or 'exit' to quit.
>say hi
>list
There are 0 of a max 20 players online: 
>^CKabirs-iPhone:~# 

This is required on certain machines (eg the iSH emulator on iOS)
@sludin
Copy link

sludin commented Sep 9, 2020

Another option is the add the following:

setvbuf( stdout, NULL, _IONBF, 0 );

To the start of main. I personally have only hit this on windows (mingw) so guarded it as such, but it sounds like the buffering may be a larger problem/inconsistency.

@Tiiffi
Copy link
Owner

Tiiffi commented Sep 11, 2020

@sludin

Another option is the add the following:

setvbuf( stdout, NULL, _IONBF, 0 );

I think this is the best solution. I will add it to the next release after some testing.

@Tiiffi Tiiffi changed the base branch from master to develop February 8, 2021 20:50
@Tiiffi Tiiffi merged commit bf11460 into Tiiffi:develop Feb 8, 2021
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.

4 participants