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>
v7.x
jBarz 8 years ago
committed by Evan Lucas
parent
commit
75efdeb635
  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) {
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;
# endif
#else // Windows
char release[256];
OSVERSIONINFOW info;

3
test/parallel/test-os.js

@ -77,6 +77,9 @@ const release = os.release();
console.log('release = ', release);
is.string(release);
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();
console.log('platform = ', platform);

Loading…
Cancel
Save