diff --git a/doc/api/os.markdown b/doc/api/os.markdown index 3c4e1b44fd..477fcba417 100644 --- a/doc/api/os.markdown +++ b/doc/api/os.markdown @@ -14,6 +14,10 @@ Returns the operating system name. Returns the operating system release. +### os.isWindows + +True on windows, false otherwise. + ### os.uptime() Returns the system uptime in seconds. diff --git a/lib/os.js b/lib/os.js index 5b1bb22d18..007070dc6b 100644 --- a/lib/os.js +++ b/lib/os.js @@ -7,4 +7,5 @@ exports.freemem = binding.getFreeMem; exports.totalmem = binding.getTotalMem; exports.cpus = binding.getCPUs; exports.type = binding.getOSType; -exports.release = binding.getOSRelease; \ No newline at end of file +exports.release = binding.getOSRelease; +exports.isWindows = binding.isWindows; \ No newline at end of file diff --git a/src/node_os.cc b/src/node_os.cc index 758648835e..fd6395e947 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -145,6 +145,12 @@ void OS::Initialize(v8::Handle target) { NODE_SET_METHOD(target, "getCPUs", GetCPUInfo); NODE_SET_METHOD(target, "getOSType", GetOSType); NODE_SET_METHOD(target, "getOSRelease", GetOSRelease); + +#ifdef __POSIX__ + target->Set(String::New("isWindows"), False()); +#else // __MINGW32__ + target->Set(String::New("isWindows"), True()); +#endif }