While improving a build script by parallelising actions, I realised that Ruby’s
puts is not atomic.
puts is calling the underlying
write function twice - Once to actually print the variable given to it, and once again to print the newline character. This leads to a race condition in
puts, as observed above.