Is there a way to programmatically determine if a Ruby script is being run from the Windows DOS shell, Linux bash shell etc.?
I am trying to emit ANSI colour codes on any console that supports it. I have used the term-ansicolor gem along with win32console to translate ANSI colour codes to native Windows command line colour sequences. However, I have found this solution to be quite flaky.
I want to emit ANSI on ANSI-capable consoles only (note this script is run on Windows and Linux with various alternate third-party shells).