Skip to content

Commit 7505b86

Browse files
jBarzMylesBorins
authored andcommitted
os: fix os.release() for aix and add test
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]>
1 parent 0bb77f2 commit 7505b86

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/node_os.cc

+7
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,14 @@ static void GetOSRelease(const FunctionCallbackInfo<Value>& args) {
8383
if (uname(&info) < 0) {
8484
return env->ThrowErrnoException(errno, "uname");
8585
}
86+
# ifdef _AIX
87+
char release[256];
88+
snprintf(release, sizeof(release),
89+
"%s.%s", info.version, info.release);
90+
rval = release;
91+
# else
8692
rval = info.release;
93+
# endif
8794
#else // Windows
8895
char release[256];
8996
OSVERSIONINFOW info;

test/parallel/test-os.js

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ assert.ok(type.length > 0);
6262
var release = os.release();
6363
console.log('release = ', release);
6464
assert.ok(release.length > 0);
65+
//TODO: Check format on more than just AIX
66+
if (common.isAix)
67+
assert.ok(/^\d+\.\d+$/.test(release));
6568

6669
var platform = os.platform();
6770
console.log('platform = ', platform);

0 commit comments

Comments
 (0)