Skip to content

Flush stdout when needed#39

Merged
Tiiffi merged 1 commit intoTiiffi:developfrom
kabiroberai:master
Feb 8, 2021
Merged

Flush stdout when needed#39
Tiiffi merged 1 commit intoTiiffi:developfrom
kabiroberai:master

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
Tiiffi added a commit that referenced this pull request Dec 4, 2024
Tiiffi added a commit that referenced this pull request Dec 6, 2024
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