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 <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
jBarz authored and MylesBorins committed Feb 1, 2017
1 parent 0bb77f2 commit 7505b86
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 7505b86

Please sign in to comment.