Skip to content

Commit 7271cb0

Browse files
evanlucasjasnell
authored andcommitted
src: add process.versions.icu
If i18n support is present, add the icu version to process.versions Fixes: #3089 PR-URL: #3102 Reviewed-By: Steven R Loomis <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
1 parent f638402 commit 7271cb0

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

doc/api/process.markdown

+1
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ Will print something like:
648648
zlib: '1.2.8',
649649
ares: '1.10.0-DEV',
650650
modules: '43',
651+
icu: '55.1',
651652
openssl: '1.0.1k' }
652653

653654
## process.config

src/node.cc

+10
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
#include <string.h>
5353
#include <sys/types.h>
5454

55+
#if defined(NODE_HAVE_I18N_SUPPORT)
56+
#include <unicode/uvernum.h>
57+
#endif
58+
5559
#if defined(LEAK_SANITIZER)
5660
#include <sanitizer/lsan_interface.h>
5761
#endif
@@ -2681,6 +2685,12 @@ void SetupProcessObject(Environment* env,
26812685
"ares",
26822686
FIXED_ONE_BYTE_STRING(env->isolate(), ARES_VERSION_STR));
26832687

2688+
#if defined(NODE_HAVE_I18N_SUPPORT) && defined(U_ICU_VERSION)
2689+
READONLY_PROPERTY(versions,
2690+
"icu",
2691+
OneByteString(env->isolate(), U_ICU_VERSION));
2692+
#endif
2693+
26842694
const char node_modules_version[] = NODE_STRINGIFY(NODE_MODULE_VERSION);
26852695
READONLY_PROPERTY(
26862696
versions,

test/parallel/test-process-versions.js

+4
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ if (common.hasCrypto) {
99
expected_keys.push('openssl');
1010
}
1111

12+
if (typeof Intl !== 'undefined') {
13+
expected_keys.push('icu');
14+
}
15+
1216
assert.deepEqual(Object.keys(process.versions).sort(), expected_keys.sort());

0 commit comments

Comments
 (0)