I am trying to write to a single file from multiple streams. The problem I am facing is that I do not see anything being written to the file before the program exits.
You need file.flush to write it. You can also set file.sync = true to enable it automatically.
file.flush
file.sync = true
What is the value of the synchronization method for your io object? It is possible that either ruby ββor basic o / s buffer the output of the file.
Check out the buffering and synchronization guidelines in the documentation.