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 MylesBorins committed Jan 24, 2017
1 parent 0742272 commit adb5bed
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 @@ -83,7 +83,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 @@ -62,6 +62,9 @@ assert.ok(type.length > 0);
var release = os.release();
console.log('release = ', release);
assert.ok(release.length > 0);
//TODO: Check format on more than just AIX
if (common.isAix)
assert.ok(/^\d+\.\d+$/.test(release));

var platform = os.platform();
console.log('platform = ', platform);
Expand Down

0 comments on commit adb5bed

Please sign in to comment.