summaryrefslogtreecommitdiff
path: root/src/node_process_object.cc
AgeCommit message (Collapse)Author
2019-11-08src: persist strings that are used multiple times in the environmentVadim Gorbachev
PR-URL: https://github.com/nodejs/node/pull/30321 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-08-12doc, lib, src, test, tools: fix assorted typosXhmikosR
PR-URL: https://github.com/nodejs/node/pull/29075 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-06-19src: save exec path when initializing EnvironmentJoyee Cheung
PR-URL: https://github.com/nodejs/node/pull/28252 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-06-03src: inline ProcessCliArgs in the Environment constructorJoyee Cheung
Inline `ProcessCliArgs()` in the `Environment` constructor, and emit the `Environment` creation trace events with the arguments earlier. Remove the unused arguments passed to `CreateProcessObject()` since these are now attached to process in `PatchProcessObject()` during pre-execution instead. PR-URL: https://github.com/nodejs/node/pull/27539 Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-04-12src: replace FromJust() with Check() when possibleSam Roberts
FromJust() is often used not for its return value, but for its side-effects. In these cases, Check() exists, and is more clear as to the intent. From its comment: To be used, where the actual value of the Maybe is not needed, like Object::Set. See: https://github.com/nodejs/node/pull/26929/files#r269256335 PR-URL: https://github.com/nodejs/node/pull/27162 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-04-04process: patch more process properties during pre-executionJoyee Cheung
Delay the creation of process properties that depend on runtime states and properties that should not be accessed during bootstrap and patch them during pre-execution: - process.argv - process.execPath - process.title - process.pid - process.ppid - process.REVERT_* - process.debugPort PR-URL: https://github.com/nodejs/node/pull/26945 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2019-03-31src: add missing uv_fs_req_cleanup()cjihrig
This cleans up after the uv_fs_realpath() call a few lines up. PR-URL: https://github.com/nodejs/node/pull/27004 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-03-12process: create legacy process properties during pre-executionJoyee Cheung
Shim legacy process object properties of CLI options during pre-execution instead of serializing them during bootstrap. PR-URL: https://github.com/nodejs/node/pull/26517 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-11process: delay creation of process.env after bootstrap/node.jsJoyee Cheung
Make sure that no code is allowed to access process.env during the execution of bootstrap/node.js. PR-URL: https://github.com/nodejs/node/pull/26515 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-07src: use the config binding to carry --no-browser-globalsJoyee Cheung
Instead of setting it in the process object, since this is a configure-time option. Also added a shim that can be deprecated and removed some time later. PR-URL: https://github.com/nodejs/node/pull/26228 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-05src: use object to pass `Environment` to functionsAnna Henningsen
Use a `v8::Object` with an internal field, rather than a `v8::External`. On a `GetReturnValue().Set(Environment::GetCurrent(args) == nullptr)` noop function, this benchmarks as a ~60 % speedup, as calls to `obj->GetAlignedPointerFromInternalField()` can be inlined and the field is stored with one level of indirection less. This also makes breaking up some pieces of the `Environment` class into per-native-binding data easier, if we want to pursue that path in the future. PR-URL: https://github.com/nodejs/node/pull/26382 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-03-03src: fix warnings around node_optionsRefael Ackermann
* header explicit usage, order, and reduce use of `*-inl.h` * pointer -> const reference when possible * no variable recyclicng * `std::begin/end` prefered over `instance.begin/end` * `USE` for explicit unused resaults PR-URL: https://github.com/nodejs/node/pull/26280 Fixes: https://github.com/nodejs/node/issues/25593 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-02-27src: apply clang-tidy rule modernize-deprecated-headersgengjiawen
PR-URL: https://github.com/nodejs/node/pull/26159 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-12process: normalize process.execPath in CreateProcessObject()Joyee Cheung
Directly normalize `process.execPath` using `uv_fs_realpath` on OpenBSD before serializing it into the process object, instead of using `require('fs')` to normalize and override the path in `bootstrap/node.js`. PR-URL: https://github.com/nodejs/node/pull/26002 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-05src: split ownsProcessState off isMainThreadAnna Henningsen
Embedders may want to control whether a Node.js instance controls the current process, similar to what we currently have with `Worker`s. Previously, the `isMainThread` flag had a bit of a double usage, both for indicating whether we are (not) running a Worker and whether we can modify per-process state. PR-URL: https://github.com/nodejs/node/pull/25881 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2019-02-02process: move DEP0062 (node --debug) to end-of-lifeJoyee Cheung
This has already been practically end-of-life since `node --debug` alone would exit the process. This patch drops support of `node --inspect --debug-brk` as well. `node --inspect --debug-brk` has been deprecated since v8, it has been maintained so that vendors can target Node.js v6 and above without detecting versions. The support of `--inspect`, which starts from v6, will reach end-of-life in April 2019, it should be safe to drop the support of `--inspect --debug-brk` altogether in v12. Also removes `process._deprecatedDebugBrk` PR-URL: https://github.com/nodejs/node/pull/25828 Refs: https://github.com/nodejs/node/pull/12949 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-02-02process: exit on --debug and --debug-brk after option parsingJoyee Cheung
Moves the exit of `--debug` and `--debug-brk` earlier, that is, after the option parsing is done in the C++ land. Also removes `process._invalidDebug`. PR-URL: https://github.com/nodejs/node/pull/25828 Refs: https://github.com/nodejs/node/pull/12949 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-01-29src: pass along errors from process obj instantiationAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/25734 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
2019-01-11src: declare process-related C++ methods in node_process.hJoyee Cheung
Instead of in node_internals.h. Also move process property accessors that are not reused into node_process_object.cc and make them static. PR-URL: https://github.com/nodejs/node/pull/25397 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-01-11src: move process object creation into node_process_object.ccJoyee Cheung
Changes `SetupProcessObject` to `CreateProessObject` which creates the process object from scratch and return it to `Environment::Start` to be stored in the Environment object. PR-URL: https://github.com/nodejs/node/pull/25397 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>