Skip to content

Commit

Permalink
os: fix os.release() for aix and add test
Browse files Browse the repository at this point in the history
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
jBarz authored and evanlucas committed Jan 4, 2017
1 parent 5b7b457 commit 75efdeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-os.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 75efdeb

Please sign in to comment.