7

I am experiencing a strange problem with Ruby and Environment variables.

I am currently on a x64 machine running Windows Server 2008 R2

If I do the following in ruby: puts ENV['PROCESSOR_ARCHITECTURE']

I expect to see AMD64, however, Ruby is displaying x86

If I do: echo %PROCESSOR_ARCHITECTURE%, in the command prompt, I am greeted with AMD64

My Ruby version is: ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]

As far as I am aware, ENV['PROCESSOR_ARCHITECTURE'] should just read my environment variable...

Any ideas?

Cheers, Gareth

1 Answer 1

11

It does read your environment variable, but since your ruby executable is compiled for 32-bit, it runs in a 32-bit environment where the value of PROCESSOR_ARCHITECTURE is indeed "x86".

If you put system "echo %PROCESSOR_ARCHITECTURE%" in your ruby script, you will see that it will also output "x86".

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.