Skip to content

Commit 7708071

Browse files
jBarzMylesBorins
authored andcommitted
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>
1 parent 4052c02 commit 7708071

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/node_os.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,14 @@ static void GetOSRelease(const FunctionCallbackInfo<Value>& args) {
8585
if (uname(&info) < 0) {
8686
return env->ThrowErrnoException(errno, "uname");
8787
}
88+
# ifdef _AIX
89+
char release[256];
90+
snprintf(release, sizeof(release),
91+
"%s.%s", info.version, info.release);
92+
rval = release;
93+
# else
8894
rval = info.release;
95+
# endif
8996
#else // Windows
9097
char release[256];
9198
OSVERSIONINFOW info;

test/parallel/test-os.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ const release = os.release();
7777
console.log('release = ', release);
7878
is.string(release);
7979
assert.ok(release.length > 0);
80+
//TODO: Check format on more than just AIX
81+
if (common.isAix)
82+
assert.ok(/^\d+\.\d+$/.test(release));
8083

8184
const platform = os.platform();
8285
console.log('platform = ', platform);

0 commit comments

Comments
 (0)