Permalink
Browse files

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

PR-URL: #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>
  • Loading branch information...
1 parent 5b7b457 commit 75efdeb63569f3c463623cc57c7bc0c4958e48b4 @jBarz jBarz committed with evanlucas Dec 13, 2016
Showing with 10 additions and 0 deletions.
  1. +7 −0 src/node_os.cc
  2. +3 −0 test/parallel/test-os.js
View
@@ -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;
@@ -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);

0 comments on commit 75efdeb

Please sign in to comment.