diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-11-21 07:31:25 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-11-29 01:52:54 +0800 |
commit | 333783643e71aeef3940fae215e7cf52ef00d5f0 (patch) | |
tree | 6338e974febd1685dcf1f4d921bde577f4a274dc /test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out | |
parent | 8ce0d4fdf15d4ffdc4cf13f1db44eb1f7556741f (diff) | |
download | node-new-333783643e71aeef3940fae215e7cf52ef00d5f0.tar.gz |
console: lazy load process.stderr and process.stdout
This patch:
- Refactors the Console constructor: moves the property binding code
into and the writable streams binding code into two methods defined
on the Console.prototype with symbols.
- Refactors the global console creation: we only need to share the
property binding code from the Console constructor. To bind the
streams we can lazy load `process.stdio` and `process.stderr`
so that we don't create these streams when they are not used.
This significantly reduces the number of modules loaded during
bootstrap. Also, by calling the refactored-out method directly
we can skip the unnecessary typechecks when creating the global
console and there is no need to create a temporary Console
anymore.
- Refactors the error handler creation and the `write` method:
use a `kUseStdout` symbol to tell the internals which stream
should be loaded from the console instance. Also put the
`write` method on the Console prototype so it just loads
other properties directly off the console instance which simplifies
the call sites.
Also leaves a few TODOs for further refactoring of the console
bootstrap.
PR-URL: https://github.com/nodejs/node/pull/24534
Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out')
-rw-r--r-- | test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out b/test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out index dffbe03040..4023b51f47 100644 --- a/test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out +++ b/test/pseudo-tty/test-stderr-stdout-handle-sigwinch.out @@ -1,2 +1,2 @@ -calling stdout._refreshSize calling stderr._refreshSize +calling stdout._refreshSize |