From d1a9c029a09165ea7b9ae799d701fab8a204fe05 Mon Sep 17 00:00:00 2001 From: Rob Paton Date: Fri, 6 Oct 2017 11:48:41 -0700 Subject: [PATCH 01/12] test: increase coverage for ModuleMap Add test for ModuleMap set with ModuleJob but bad url. PR-URL: https://github.com/nodejs/node/pull/16045 Reviewed-By: Stephen Belanger Reviewed-By: Bradley Farias Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung --- test/es-module/test-esm-loader-modulemap.js | 56 +++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test/es-module/test-esm-loader-modulemap.js diff --git a/test/es-module/test-esm-loader-modulemap.js b/test/es-module/test-esm-loader-modulemap.js new file mode 100644 index 00000000000..58c76ce9606 --- /dev/null +++ b/test/es-module/test-esm-loader-modulemap.js @@ -0,0 +1,56 @@ +'use strict'; +// Flags: --expose-internals + +// This test ensures that the type checking of ModuleMap throws +// errors appropriately + +const common = require('../common'); + +const { URL } = require('url'); +const Loader = require('internal/loader/Loader'); +const ModuleMap = require('internal/loader/ModuleMap'); +const ModuleJob = require('internal/loader/ModuleJob'); +const { createDynamicModule } = require('internal/loader/ModuleWrap'); + +const stubModuleUrl = new URL('file://tmp/test'); +const stubModule = createDynamicModule(['default'], stubModuleUrl); +const loader = new Loader(); +const moduleMap = new ModuleMap(); +const moduleJob = new ModuleJob(loader, stubModule.module, + () => new Promise(() => {})); + +common.expectsError( + () => moduleMap.get(1), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "url" argument must be of type string' + } +); + +common.expectsError( + () => moduleMap.set(1, moduleJob), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "url" argument must be of type string' + } +); + +common.expectsError( + () => moduleMap.set('somestring', 'notamodulejob'), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "job" argument must be of type ModuleJob' + } +); + +common.expectsError( + () => moduleMap.has(1), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "url" argument must be of type string' + } +); From 78dbcbe559324cdd73c2a158ad6ce77a7a74717f Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Mon, 30 Oct 2017 06:58:13 -0400 Subject: [PATCH 02/12] build,src: Add CloudABI as a POSIX-like runtime environment. CloudABI is a compact POSIX-like runtime that makes use of capability-based security. More details: https://github.com/NuxiNL/cloudlibc * src: Disable use of pwd.h, grp.h and get*uid() on CloudABI. As CloudABI is intended to run applications in cluster contexts (e.g., on Kubernetes), they are oblivious of UNIX credentials. Extend the existing preprocessor checks to disable any use of these interfaces, just like on Windows, Android, etc. * src: Explicitly include . cares_wrap.cc calls into functions like getnameinfo() and getaddrinfo(). These functions tend to be available implicitly through , but we'd better still include this header explicitly. On CloudABI, we make use of a custom implementation of libuv that does not implicitly include header files like . PR-URL: https://github.com/nodejs/node/pull/16612 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: Refael Ackermann --- common.gypi | 2 +- configure | 2 +- src/cares_wrap.cc | 4 ++++ src/node.cc | 12 ++++++------ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/common.gypi b/common.gypi index c7c367ec83b..d152c814988 100644 --- a/common.gypi +++ b/common.gypi @@ -291,7 +291,7 @@ 'cflags': [ '-pthread', ], 'ldflags': [ '-pthread' ], }], - [ 'OS in "linux freebsd openbsd solaris android aix"', { + [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++0x' ], 'ldflags': [ '-rdynamic' ], diff --git a/configure b/configure index 9e04b03d4fe..95f103fbcb3 100755 --- a/configure +++ b/configure @@ -57,7 +57,7 @@ from gyp_node import run_gyp parser = optparse.OptionParser() valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', - 'android', 'aix') + 'android', 'aix', 'cloudabi') valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc', 'ppc64', 'x32','x64', 'x86', 's390', 's390x') valid_arm_float_abi = ('soft', 'softfp', 'hard') diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 1abbbe629a6..77426c4acd4 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -34,6 +34,10 @@ #include #include +#ifdef __POSIX__ +# include +#endif // __POSIX__ + #if defined(__ANDROID__) || \ defined(__MINGW32__) || \ defined(__OpenBSD__) || \ diff --git a/src/node.cc b/src/node.cc index 33bf5199d63..bfe36f218ad 100644 --- a/src/node.cc +++ b/src/node.cc @@ -108,7 +108,7 @@ typedef int mode_t; #include // setuid, getuid #endif -#if defined(__POSIX__) && !defined(__ANDROID__) +#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) #include // getpwnam() #include // getgrnam() #endif @@ -1002,7 +1002,7 @@ Local UVException(Isolate* isolate, // Look up environment variable unless running as setuid root. bool SafeGetenv(const char* key, std::string* text) { -#ifndef _WIN32 +#if !defined(__CloudABI__) && !defined(_WIN32) if (linux_at_secure || getuid() != geteuid() || getgid() != getegid()) goto fail; #endif @@ -2122,7 +2122,7 @@ static void Umask(const FunctionCallbackInfo& args) { } -#if defined(__POSIX__) && !defined(__ANDROID__) +#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) static const uid_t uid_not_found = static_cast(-1); static const gid_t gid_not_found = static_cast(-1); @@ -2441,7 +2441,7 @@ static void InitGroups(const FunctionCallbackInfo& args) { } } -#endif // __POSIX__ && !defined(__ANDROID__) +#endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__) static void WaitForInspectorDisconnect(Environment* env) { @@ -3706,7 +3706,7 @@ void SetupProcessObject(Environment* env, env->SetMethod(process, "umask", Umask); -#if defined(__POSIX__) && !defined(__ANDROID__) +#if defined(__POSIX__) && !defined(__ANDROID__) && !defined(__CloudABI__) env->SetMethod(process, "getuid", GetUid); env->SetMethod(process, "geteuid", GetEUid); env->SetMethod(process, "setuid", SetUid); @@ -3720,7 +3720,7 @@ void SetupProcessObject(Environment* env, env->SetMethod(process, "getgroups", GetGroups); env->SetMethod(process, "setgroups", SetGroups); env->SetMethod(process, "initgroups", InitGroups); -#endif // __POSIX__ && !defined(__ANDROID__) +#endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__) env->SetMethod(process, "_kill", Kill); From 94b2be7a96a5b50022ea523af069c96dfb559fe0 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Tue, 31 Oct 2017 01:44:59 +0000 Subject: [PATCH 03/12] doc: fix Changelog link order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16632 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: Anatoli Papirovski Reviewed-By: Tobias Nießen Reviewed-By: Khaidi Chu Reviewed-By: Brian White --- CHANGELOG.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13fc70bcb8b..818f8f1eeae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,12 @@ Select a Node.js version below to view the changelog history: * [Node.js 8](doc/changelogs/CHANGELOG_V8.md) * [Node.js 7](doc/changelogs/CHANGELOG_V7.md) * [Node.js 6](doc/changelogs/CHANGELOG_V6.md) +* [Node.js 5](doc/changelogs/CHANGELOG_V5.md) * [Node.js 4](doc/changelogs/CHANGELOG_V4.md) -* [Node.js 5](doc/changelogs/CHANGELOG_V5.md), - [0.12](doc/changelogs/CHANGELOG_V012.md), - [0.10](doc/changelogs/CHANGELOG_V010.md), - [io.js](doc/changelogs/CHANGELOG_IOJS.md) and [Archive](doc/changelogs/CHANGELOG_ARCHIVE.md) +* [io.js](doc/changelogs/CHANGELOG_IOJS.md) +* [Node.js 0.12](doc/changelogs/CHANGELOG_V012.md) +* [Node.js 0.10](doc/changelogs/CHANGELOG_V010.md) +* [Archive](doc/changelogs/CHANGELOG_ARCHIVE.md) Please use the following table to find the changelog for a specific Node.js release. From 67c8511ea13b6def8c39042b10749a9b182feeac Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 26 Oct 2017 22:04:07 -0700 Subject: [PATCH 04/12] src: use internal/errors for startSigintWatchdog Move the throw out of c++ and into js using internal/errors PR-URL: https://github.com/nodejs/node/pull/16546 Reviewed-By: Luigi Pinca Reviewed-By: Matteo Collina Reviewed-By: Joyee Cheung Reviewed-By: Michael Dawson --- doc/api/errors.md | 5 +++++ lib/internal/errors.js | 1 + lib/repl.js | 3 ++- src/node_util.cc | 5 +---- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 8805e5ec03a..23817ef3d19 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -615,6 +615,11 @@ Used when attempting to perform an operation outside the bounds of a `Buffer`. Used when an attempt has been made to create a `Buffer` larger than the maximum allowed size. + +### ERR_CANNOT_WATCH_SIGINT + +Used when Node.js is unable to watch for the `SIGINT` signal. + ### ERR_CHILD_CLOSED_BEFORE_REPLY diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 31b972326a1..7148279672c 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -151,6 +151,7 @@ E('ERR_ASYNC_TYPE', (s) => `Invalid name for async "type": ${s}`); E('ERR_BUFFER_OUT_OF_BOUNDS', bufferOutOfBounds); E('ERR_BUFFER_TOO_LARGE', `Cannot create a Buffer larger than 0x${kMaxLength.toString(16)} bytes`); +E('ERR_CANNOT_WATCH_SIGINT', 'Cannot watch for SIGINT signals'); E('ERR_CHILD_CLOSED_BEFORE_REPLY', 'Child closed before reply received'); E('ERR_CONSOLE_WRITABLE_STREAM', 'Console expects a writable stream instance for %s'); diff --git a/lib/repl.js b/lib/repl.js index 40c3a68714c..9aa2625a4fb 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -227,7 +227,8 @@ function REPLServer(prompt, if (self.breakEvalOnSigint) { // Start the SIGINT watchdog before entering raw mode so that a very // quick Ctrl+C doesn't lead to aborting the process completely. - utilBinding.startSigintWatchdog(); + if (!utilBinding.startSigintWatchdog()) + throw new errors.Error('ERR_CANNOT_WATCH_SIGINT'); previouslyInRawMode = self._setRawMode(false); } diff --git a/src/node_util.cc b/src/node_util.cc index cf26eca692e..fa30ae44722 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -135,10 +135,7 @@ static void SetHiddenValue(const FunctionCallbackInfo& args) { void StartSigintWatchdog(const FunctionCallbackInfo& args) { int ret = SigintWatchdogHelper::GetInstance()->Start(); - if (ret != 0) { - Environment* env = Environment::GetCurrent(args); - env->ThrowErrnoException(ret, "StartSigintWatchdog"); - } + args.GetReturnValue().Set(ret == 0); } From 2244f7d9923e4037bb10b8f8f41ebc8c19e783cb Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 29 Oct 2017 19:54:45 -0700 Subject: [PATCH 05/12] test,net: remove scatological terminology PR-URL: https://github.com/nodejs/node/pull/16599 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Anatoli Papirovski --- lib/net.js | 2 +- test/parallel/test-async-wrap-uncaughtexception.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/net.js b/lib/net.js index facf5d0d6b7..78e12fac208 100644 --- a/lib/net.js +++ b/lib/net.js @@ -321,7 +321,7 @@ function afterShutdown(status, handle, req) { // if the writable side has ended already, then clean everything // up. function onSocketEnd() { - // XXX Should not have to do as much crap in this function. + // XXX Should not have to do as much in this function. // ended should already be true, since this is called *after* // the EOF errno and onread has eof'ed debug('onSocketEnd', this._readableState); diff --git a/test/parallel/test-async-wrap-uncaughtexception.js b/test/parallel/test-async-wrap-uncaughtexception.js index 9427e2fb787..37557b4aacc 100644 --- a/test/parallel/test-async-wrap-uncaughtexception.js +++ b/test/parallel/test-async-wrap-uncaughtexception.js @@ -42,5 +42,5 @@ process.on('uncaughtException', common.mustCall(() => { require('crypto').randomBytes(1, common.mustCall(() => { assert.strictEqual(call_id, async_hooks.executionAsyncId()); call_log[1]++; - throw new Error('ah crap'); + throw new Error(); })); From 635d06442dcf38560ae499df4703e81eaad1006a Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Tue, 31 Oct 2017 08:31:50 -0500 Subject: [PATCH 06/12] src: pass context to Get() operations for cares_wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using Get() without the context argument will soon be deprecated. This also passed context to Int32Value() operations as well. PR-URL: https://github.com/nodejs/node/pull/16641 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Anatoli Papirovski Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- src/cares_wrap.cc | 55 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 77426c4acd4..2cd494fca81 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1231,7 +1231,9 @@ class QueryAnyWrap: public QueryWrap { CHECK_EQ(naddrttls, a_count); for (int i = 0; i < a_count; i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->address_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->address_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->ttl_string(), Integer::New(env()->isolate(), addrttls[i].ttl)).FromJust(); @@ -1243,7 +1245,9 @@ class QueryAnyWrap: public QueryWrap { } else { for (int i = 0; i < a_count; i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->value_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->value_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->type_string(), env()->dns_cname_string()).FromJust(); @@ -1272,7 +1276,9 @@ class QueryAnyWrap: public QueryWrap { CHECK_EQ(aaaa_count, naddr6ttls); for (uint32_t i = a_count; i < ret->Length(); i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->address_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->address_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->ttl_string(), Integer::New(env()->isolate(), addr6ttls[i].ttl)).FromJust(); @@ -1299,7 +1305,9 @@ class QueryAnyWrap: public QueryWrap { } for (uint32_t i = old_count; i < ret->Length(); i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->value_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->value_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->type_string(), env()->dns_ns_string()).FromJust(); @@ -1325,7 +1333,9 @@ class QueryAnyWrap: public QueryWrap { status = ParseGeneralReply(env(), buf, len, &type, ret); for (uint32_t i = old_count; i < ret->Length(); i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->value_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->value_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->type_string(), env()->dns_ptr_string()).FromJust(); @@ -1945,10 +1955,14 @@ void GetAddrInfo(const FunctionCallbackInfo& args) { Local req_wrap_obj = args[0].As(); node::Utf8Value hostname(env->isolate(), args[1]); - int32_t flags = (args[3]->IsInt32()) ? args[3]->Int32Value() : 0; + int32_t flags = 0; + if (args[3]->IsInt32()) { + flags = args[3]->Int32Value(env->context()).FromJust(); + } + int family; - switch (args[2]->Int32Value()) { + switch (args[2]->Int32Value(env->context()).FromJust()) { case 0: family = AF_UNSPEC; break; @@ -1992,7 +2006,7 @@ void GetNameInfo(const FunctionCallbackInfo& args) { CHECK(args[2]->IsUint32()); Local req_wrap_obj = args[0].As(); node::Utf8Value ip(env->isolate(), args[1]); - const unsigned port = args[2]->Uint32Value(); + const unsigned port = args[2]->Uint32Value(env->context()).FromJust(); struct sockaddr_storage addr; CHECK(uv_ip4_addr(*ip, port, reinterpret_cast(&addr)) == 0 || @@ -2069,17 +2083,23 @@ void SetServers(const FunctionCallbackInfo& args) { int err; for (uint32_t i = 0; i < len; i++) { - CHECK(arr->Get(i)->IsArray()); + CHECK(arr->Get(env->context(), i).ToLocalChecked()->IsArray()); - Local elm = Local::Cast(arr->Get(i)); + Local elm = + Local::Cast(arr->Get(env->context(), i).ToLocalChecked()); - CHECK(elm->Get(0)->Int32Value()); - CHECK(elm->Get(1)->IsString()); - CHECK(elm->Get(2)->Int32Value()); + CHECK(elm->Get(env->context(), + 0).ToLocalChecked()->Int32Value(env->context()).FromJust()); + CHECK(elm->Get(env->context(), 1).ToLocalChecked()->IsString()); + CHECK(elm->Get(env->context(), + 2).ToLocalChecked()->Int32Value(env->context()).FromJust()); - int fam = elm->Get(0)->Int32Value(); - node::Utf8Value ip(env->isolate(), elm->Get(1)); - int port = elm->Get(2)->Int32Value(); + int fam = elm->Get(env->context(), 0) + .ToLocalChecked()->Int32Value(env->context()).FromJust(); + node::Utf8Value ip(env->isolate(), + elm->Get(env->context(), 1).ToLocalChecked()); + int port = elm->Get(env->context(), 2) + .ToLocalChecked()->Int32Value(env->context()).FromJust(); ares_addr_port_node* cur = &servers[i]; @@ -2129,7 +2149,8 @@ void Cancel(const FunctionCallbackInfo& args) { void StrError(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - const char* errmsg = ares_strerror(args[0]->Int32Value()); + const char* errmsg = ares_strerror(args[0]->Int32Value(env->context()) + .FromJust()); args.GetReturnValue().Set(OneByteString(env->isolate(), errmsg)); } From 41611f9adbae7b846c16580ff9eb0f4a8a87a08b Mon Sep 17 00:00:00 2001 From: Andrew Stucki Date: Wed, 18 Oct 2017 12:33:27 -0500 Subject: [PATCH 07/12] doc: add windowsVerbatimArguments docs doc: Add windowsVerbatimArguments docs for child_process spawn, spawnSync, execFile, and fork PR-URL: https://github.com/nodejs/node/pull/16299 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/api/child_process.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 64bee59a661..48b8f395b23 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -264,6 +264,8 @@ changes: * `gid` {number} Sets the group identity of the process (see setgid(2)). * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. **Default:** `false`. * `callback` {Function} Called with the output when process terminates. * `error` {Error} * `stdout` {string|Buffer} @@ -338,6 +340,8 @@ changes: When this option is provided, it overrides `silent`. If the array variant is used, it must contain exactly one item with value `'ipc'` or an error will be thrown. For instance `[0, 1, 2, 'ipc']`. + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. **Default:** `false`. * `uid` {number} Sets the user identity of the process (see setuid(2)). * `gid` {number} Sets the group identity of the process (see setgid(2)). * Returns: {ChildProcess} @@ -404,6 +408,9 @@ changes: `'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different shell can be specified as a string. See [Shell Requirements][] and [Default Windows Shell][]. **Default:** `false` (no shell). + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. This is set to `true` automatically + when `shell` is specified. **Default:** `false`. * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. * Returns: {ChildProcess} @@ -813,6 +820,9 @@ changes: `'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different shell can be specified as a string. See [Shell Requirements][] and [Default Windows Shell][]. **Default:** `false` (no shell). + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. This is set to `true` automatically + when `shell` is specified. **Default:** `false`. * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. * Returns: {Object} From 367db920e3b69ed9ded50cf6e652b9f581e10748 Mon Sep 17 00:00:00 2001 From: Anthony Nandaa Date: Sat, 28 Oct 2017 01:06:52 +0300 Subject: [PATCH 08/12] doc: add details about rss on process.memoryUsage 1. `process.memoryUsage()` returns an object with 4 keys: `rss, heapTotal, headUsed, external`. There were brief explanations for the rest except `rss`. This commit adds this on the docs. 2. A little more clarity on `rss` to help people disambiguate it from the virtual memory size. PR-URL: https://github.com/nodejs/node/pull/16566 Refs: https://github.com/nodejs/node/pull/16566#discussion_r147545405 Reviewed-By: Refael Ackermann Reviewed-By: Gibson Fahnestock Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- doc/api/process.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index 89c245475e6..4ff5013f50d 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1282,7 +1282,13 @@ Will generate: `heapTotal` and `heapUsed` refer to V8's memory usage. `external` refers to the memory usage of C++ objects bound to JavaScript -objects managed by V8. +objects managed by V8. `rss`, Resident Set Size, is the amount of space +occupied in the main memory device (that is a subset of the total allocated +memory) for the process, which includes the _heap_, _code segment_ and _stack_. + +The _heap_ is where objects, strings and closures are stored. Variables are +stored in the _stack_ and the actual JavaScript code resides in the +_code segment_. ## process.nextTick(callback[, ...args])