Browse Source

os: fix os.release() for aix and add test

PR-URL: https://github.com/nodejs/node/pull/10245
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
jBarz 8 years ago
committed by James M Snell
parent
commit
1c3c75dac2
  1. 7
      src/node_os.cc
  2. 3
      test/parallel/test-os.js

7
src/node_os.cc

@ -85,7 +85,14 @@ static void GetOSRelease(const FunctionCallbackInfo<Value>& args) {
if (uname(&info) < 0) { if (uname(&info) < 0) {
return env->ThrowErrnoException(errno, "uname"); return env->ThrowErrnoException(errno, "uname");
} }
# ifdef _AIX
char release[256];
snprintf(release, sizeof(release),
"%s.%s", info.version, info.release);
rval = release;
# else
rval = info.release; rval = info.release;
# endif
#else // Windows #else // Windows
char release[256]; char release[256];
OSVERSIONINFOW info; OSVERSIONINFOW info;

3
test/parallel/test-os.js

@ -77,6 +77,9 @@ const release = os.release();
console.log('release = ', release); console.log('release = ', release);
is.string(release); is.string(release);
assert.ok(release.length > 0); assert.ok(release.length > 0);
//TODO: Check format on more than just AIX
if (common.isAix)
assert.ok(/^\d+\.\d+$/.test(release));
const platform = os.platform(); const platform = os.platform();
console.log('platform = ', platform); console.log('platform = ', platform);

Loading…
Cancel
Save