os: fix os.release() for aix and add test
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
97ab4b2998
commit
1c3c75dac2
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user