I'm having a really weird problem here. Here's simple code that uses puts:
puts "Dale"
sleep 1
puts "Cooper"
I have 3 different terminals/consoles:
- Windows console (system default)
- mingw64 (UNIX-like terminal that was installed alongside with Git)
- cygwin64 (UNIX-like terminal)
Here is weird thing: the code runs as expected only in the standard Windows console. UNIX-like terminals are waiting for 1 second and only then showing output (both lines at the same moment). Basically, UNIX-like terminals are waiting for the program to exit, and then they are showing the final result of output.
If I replace puts with print, it wont affect the execution process. UNIX-like terminals will still delay output until the program quits.
But the next two examples work right in all 3 terminals/consoles:
system("echo Dale")
sleep 1
system("echo Cooper")
This one adds quotes, but aside from this, the code works as expected.
p "Dale"
sleep 1
p "Cooper"
Having said this, I assume this has something to do with Ruby. I have tried different versions of Ruby.
Can someone explain why this is happening and what are possible ways to bypass this issue?