I have objective-C code that calls ruby scripts and monitors STDOUT. However, ruby does not seem to synchronise STDOUT by default, so I need to put STDOUT.sync = true at the beginning of the script to see output as it happens.
Can I do this as a command line option when calling a ruby script?
You can create a setup file to require before your script. Then call ruby with the
-rflag:You can also set the environment variable
RUBYOPTto automatically include that file every time you run ruby: