I need to determine what environment my ruby script is running in so I can remove files and clean up directories after execution.
I tried using ENV['os']
but I am using cygwin and it gave me Windows_NT, Does anyone know a way to find the current environment?
Thanks
The current environment is provided by the global constant RUBY_PLATFORM
ruby invoked at the cygwin bash shell (/usr/bin/ruby):
puts RUBY_PLATFORM
i386-cygwin
ruby invoked at the command prompt (c:\Ruby193\bin\ruby.exe):
puts RUBY_PLATFORM
i386-mingw32
puts ENV['OS']
for both of the above environment returns: Windows_NT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With