summaryrefslogtreecommitdiff
path: root/lib/tty.js
Commit message (Collapse)AuthorAgeFilesLines
* lib: add trailing commas to all public core modulesAntoine du Hamel2023-02-281-3/+3
| | | | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/46848 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
* tty: fix TypeError when stream is closedAntoine du Hamel2022-08-241-1/+1
| | | | | Fixes: https://github.com/nodejs/node/issues/41330 PR-URL: https://github.com/nodejs/node/pull/43803 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* tty: enable bufferingRobert Nagy2021-07-071-2/+2
| | | | | | | | | | | HWM was set to 0 which would cause e.g. stdout.write(...) to always return false. Refs: https://github.com/nodejs/node/pull/39246 PR-URL: https://github.com/nodejs/node/pull/39253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
* stream: error Duplex write/read if not writable/readableRobert Nagy2021-07-021-6/+5
| | | | | | | | | | | | | If writable/readable has been explicitly disabled then using a Duplex as writable/readable should fail. Fixes: https://github.com/nodejs/node/issues/34374 PR-URL: https://github.com/nodejs/node/pull/34385 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* tty: validate file descriptor to avoid int32 overflowAntoine du Hamel2021-03-231-1/+2
| | | | | | | | | | Fixes: https://github.com/nodejs/node/issues/37805 PR-URL: https://github.com/nodejs/node/pull/37809 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
* tty: refactor to avoid unsafe array iterationAntoine du Hamel2021-01-061-1/+1
| | | | | | PR-URL: https://github.com/nodejs/node/pull/36771 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
* lib: use static Number properties from primordialsMichaël Zasso2019-11-301-1/+2
| | | | | | PR-URL: https://github.com/nodejs/node/pull/30686 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* lib: enforce use of Array from primordialsMichaël Zasso2019-11-271-0/+1
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/30635 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* lib: flatten access to primordialsMichaël Zasso2019-11-251-5/+7
| | | | | | | | | | | | | | Store all primordials as properties of the primordials object. Static functions are prefixed by the constructor's name and prototype methods are prefixed by the constructor's name followed by "Prototype". For example: primordials.Object.keys becomes primordials.ObjectKeys. PR-URL: https://github.com/nodejs/node/pull/30610 Refs: https://github.com/nodejs/node/issues/29766 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* tty: expose stream API from readline methodscjihrig2019-07-181-8/+8
| | | | | | | | | | This commit exposes the return value and callback of the underlying readline APIs from the tty module. PR-URL: https://github.com/nodejs/node/pull/28721 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* lib: enforce the use of Object from primordialsMichaël Zasso2019-04-121-0/+2
| | | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/27146 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
* tty: remove util.inherits usagend-021101142019-03-251-3/+6
| | | | | | PR-URL: https://github.com/nodejs/node/pull/26797 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
* tty: add hasColors functionRuben Bridgewater2019-03-051-1/+6
| | | | | | | | | | | | | | This adds a small wrapper around the `getColorDepth` function to check if the stream supports at least a specific amount of colors. This is convenient as the other API is not as straight forward and most use cases likely only want to know if a specific amount of colors is supported or not. PR-URL: https://github.com/nodejs/node/pull/26247 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
* lib: remove internal `util._extends()` usageRuben Bridgewater2018-12-201-6/+5
| | | | | | | | | | | | | This removes all internal calls to the deprecated `_extends()` function. It is slower than `Object.assign()` and the object spread notation since V8 6.8 and using the spread notation often also results in shorter code. PR-URL: https://github.com/nodejs/node/pull/25105 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* Revert "tty: make _read throw ERR_TTY_WRITABLE_NOT_READABLE"Anna Henningsen2018-10-041-12/+1
| | | | | | | | | | This reverts commit 91eec00ca20a54b1dc010cfc2fb34bc2f39eab6b. Refs: https://github.com/nodejs/node/pull/21654 Refs: https://github.com/nodejs/node/issues/21203 PR-URL: https://github.com/nodejs/node/pull/23053 Reviewed-By: James M Snell <jasnell@gmail.com>
* bootstrapper: move internalBinding to NativeModuleGus Caplan2018-10-041-1/+0
| | | | | | | | | | | | | | | | | | internalBinding is used so often that it should just automatically be available for usage in internals. PR-URL: https://github.com/nodejs/node/pull/23025 Refs: https://github.com/nodejs/node/commit/2a9eb31 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* tty: make `readStream.setRawMode()` return `this`Alexander Mills2018-09-221-1/+2
| | | | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/22950 Fixes: https://github.com/nodejs/node/issues/22916 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
* tty: handle setRawMode errorsNikolai Vavilov2018-09-191-1/+5
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/22886 Refs: https://github.com/nodejs/node/issues/21773 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* tty: make process.binding('tty_wrap') internalcjihrig2018-08-291-1/+2
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/22477 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
* tty: make _read throw ERR_TTY_WRITABLE_NOT_READABLEMatteo Collina2018-08-221-1/+12
| | | | | | | | | | | | | | This change avoid an 'read ENOTCONN' error introduced by libuv 1.20.0 when trying to read from a TTY WriteStream. Instead, we are throwing a more actionable ERR_TTY_WRITABLE_NOT_READABLE. Fixes: https://github.com/nodejs/node/issues/21203 PR-URL: https://github.com/nodejs/node/pull/21654 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* readline: lazy loadedRuben Bridgewater2018-05-181-1/+7
| | | | | | | | PR-URL: https://github.com/nodejs/node/pull/20567 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* errors: improve SystemError messagesJoyee Cheung2018-04-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit improves the SystemError messages by allowing user to combine a custom message and the libuv error message. Also since we now prefer use subclasses to construct the errors instead of using `new errors.SystemError()` directly, this removes the behavior of assigning a default error code `ERR_SYSTEM_ERROR` to SystemError and requires the user to directly use the `ERR_SYSTEM_ERROR` class to construct errors instead. Also merges `makeNodeError` into the SystemError class definition since that's the only place the function gets used and it seems unnecessary to introduce another level of inheritance. SystemError now directly inherits from Error instead of an intermmediate Error class that inherits from Error. Class hierarchy before this patch: ERR_SOCKET_BUFFER_SIZE -> Error (use message formatted by SystemError) ERR_SYSTEM_ERROR -> NodeError (temp) -> Error After: ERR_SOCKET_BUFFER_SIZE -> SystemError -> Error ERR_TTY_INIT_FAILED -> SystemError -> Error ERR_SYSTEM_ERROR -> SystemError -> Error Error messages before this patch: ``` const dgram = require('dgram'); const socket = dgram.createSocket('udp4'); socket.setRecvBufferSize(8192); // Error [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer // size: Error [ERR_SYSTEM_ERROR]: bad file descriptor: // EBADF [uv_recv_buffer_size] // at bufferSize (dgram.js:191:11) // at Socket.setRecvBufferSize (dgram.js:689:3) const tty = require('tty'); new tty.WriteStream(1 << 30); // Error [ERR_SYSTEM_ERROR]: invalid argument: EINVAL [uv_tty_init] // at new WriteStream (tty.js:84:11) ``` After: ``` const dgram = require('dgram'); const socket = dgram.createSocket('udp4'); socket.setRecvBufferSize(8192); // SystemError [ERR_SOCKET_BUFFER_SIZE]: Could not get or set buffer // size: uv_recv_buffer_size returned EBADF (bad file descriptor) // at bufferSize (dgram.js:191:11) // at Socket.setRecvBufferSize (dgram.js:689:3) const tty = require('tty'); new tty.WriteStream(1 << 30); // SystemError [ERR_TTY_INIT_FAILED]: TTY initialization failed: // uv_tty_init returned EINVAL (invalid argument) // at new WriteStream (tty.js:84:11) ``` PR-URL: https://github.com/nodejs/node/pull/19514 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* tty: add attribution for chalkRuben Bridgewater2018-04-041-72/+2
| | | | | | | | | | | | This adds attributions for the getColorDepth function as it got inspired by https://github.com/chalk/supports-color and more sources. PR-URL: https://github.com/nodejs/node/pull/19730 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
* lib: port errors to new systemMichaël Zasso2018-03-051-2/+3
| | | | | | | | | | This is a first batch of updates that touches non-underscored modules in lib. PR-URL: https://github.com/nodejs/node/pull/19034 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* errors: move error creation helpers to errors.jsJoyee Cheung2018-02-071-2/+2
| | | | | | | | | | | | | | | | | This commit moves error creation helpers scattered around under lib/ into lib/internal/errors.js in the hope of being clearer about the differences of errors that we throw into the user land. - Move util._errnoException and util._exceptionWithHostPort into internal/errors.js and simplify their logic so it's clearer what the properties these helpers create. - Move the errnoException helper in dns.js to internal/errors.js into internal/errors.js and rename it to dnsException. Simplify it's logic so it no longer calls errnoException and skips the unnecessary argument checks. PR-URL: https://github.com/nodejs/node/pull/18546 Reviewed-By: James M Snell <jasnell@gmail.com>
* tty: refactor to es6Ruben Bridgewater2018-01-241-19/+11
| | | | | | PR-URL: https://github.com/nodejs/node/pull/17615 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* tty: add getColorDepth functionRuben Bridgewater2018-01-241-0/+72
| | | | | | | | | | Right now it is very difficult to determine if a terminal supports colors or not. This function adds this functionality by detecting environment variables and checking process. PR-URL: https://github.com/nodejs/node/pull/17615 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* tty: fix console printing on WindowsAnna Henningsen2018-01-191-3/+0
| | | | | | | | | | | | | | | | This broke writing non-ASCII data to the console on Windows because the result would be codepage-dependent. This partially reverts 8b751f7eb7b05a0b27f52e2288a636fdd78e9ecb. Fixes: https://github.com/nodejs/node/issues/18189 Refs: https://github.com/nodejs/node/pull/18019 PR-URL: https://github.com/nodejs/node/pull/18214 Fixes: https://github.com/nodejs/node/issues/18189 Refs: https://github.com/nodejs/node/pull/18019 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* process: use more direct sync I/O for stdioAnna Henningsen2018-01-141-0/+3
| | | | | | | | | | | | | | | This avoids routing writes through the full LibuvStreamWrap write machinery. In particular, it enables the next commit, because otherwise the callback passed to `_write()` would not be called synchronously for pipes on Windows (because the latter does not support `uv_try_write()`, even for blocking I/O). PR-URL: https://github.com/nodejs/node/pull/18019 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* tty: refactor exportscjihrig2017-11-141-5/+5
| | | | | | | | | | This commit moves the tty module's exports to a single object, which is more aligned with other core modules. PR-URL: https://github.com/nodejs/node/pull/16959 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* tty: convert to internal/errors using SystemErrorJames M Snell2017-11-021-2/+14
| | | | | | PR-URL: https://github.com/nodejs/node/pull/16567 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* tty,doc: add type-check to isattyBryan English2017-10-221-1/+1
| | | | | | | | | | | | | | | | | Previously, various inputs other than non-negative integers would produce incorrect results. Added type-checking on input, returning false for anything other than non-negative integers. Also clarified in docs. PR-URL: https://github.com/nodejs/node/pull/15567 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* lib: use destructuring for some constantsWeijia Wang2017-10-161-3/+2
| | | | | | | | | | | | | This change is to unify the declaration for constants into using destructuring on the top-level-module scope, reducing some redundant code. PR-URL: https://github.com/nodejs/node/pull/16063 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
* tty: require readline at top of fileBryan English2017-10-011-4/+5
| | | | | | | | | | | No need to require it on each of those function calls. PR-URL: https://github.com/nodejs/node/pull/15647 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* lib: fix typosRuben Bridgewater2017-06-191-1/+1
| | | | | | | | | PR-URL: https://github.com/nodejs/node/pull/13741 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
* errors,tty: migrate to use internal/errors.jsGautam Mittal2017-06-061-3/+3
| | | | | | PR-URL: https://github.com/nodejs/node/pull/13240 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
* tty_wrap: throw when uv_tty_init() returns errorTrevor Norris2017-05-101-1/+7
| | | | | | | | | | | | | | | Also add checks in lib/tty.js and tests. PR-URL: https://github.com/nodejs/node/pull/12892 Ref: https://github.com/nodejs/node/pull/11883 Ref: https://github.com/nodejs/node/pull/8531 Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
* tty: remove NODE_TTY_UNSAFE_ASYNCJeremiah Senkpiel2017-03-311-1/+1
| | | | | | | | | Nothing but trouble can ever come from it. PR-URL: https://github.com/nodejs/node/pull/12057 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* meta: restore original copyright headerJames M Snell2017-03-101-0/+21
| | | | | | | | | | | | | | | A prior io.js era commit inappropriately removed the original copyright statements from the source. This restores those in any files still remaining from that edit. Ref: https://github.com/nodejs/TSC/issues/174 Ref: https://github.com/nodejs/node/pull/10599 PR-URL: https://github.com/nodejs/node/pull/10155 Note: This PR was required, reviewed-by and approved by the Node.js Foundation Legal Committee and the TSC. There is no `Approved-By:` meta data.
* tty: avoid oob warning in TTYWrap::GetWindowSize()Dmitry Tsvettsikh2017-02-221-2/+2
| | | | | | PR-URL: https://github.com/nodejs/node/pull/11454 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* tty: set the handle to blocking modeJeremiah Senkpiel2016-08-101-2/+2
| | | | | | | | | | | | | | Refs: https://github.com/nodejs/node/pull/1771 Refs: https://github.com/nodejs/node/issues/6456 Refs: https://github.com/nodejs/node/pull/6773 Refs: https://github.com/nodejs/node/issues/7743 PR-URL: https://github.com/nodejs/node/pull/6816 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* tty: use blocking mode on OS XJeremiah Senkpiel2016-06-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OS X has a tiny 1kb hard-coded buffer size for stdout / stderr to TTYs (terminals). Output larger than that causes chunking, which ends up having some (very small but existent) delay past the first chunk. That causes two problems: 1. When output is written to stdout and stderr at similar times, the two can become mixed together (interleaved). This is especially problematic when using control characters, such as \r. With interleaving, chunked output will often have lines or characters erased unintentionally, or in the wrong spots, leading to broken output. CLI apps often extensively use such characters for things such as progress bars. 2. Output can be lost if the process is exited before chunked writes are finished flushing. This usually happens in applications that use `process.exit()`, which isn't infrequent. See https://github.com/nodejs/node/issues/6980 for more info. This became an issue as result of the Libuv 1.9.0 upgrade. A fix to an unrelated issue broke a hack previously required for the OS X implementation. This resulted in an unexpected behavior change in node. The 1.9.0 upgrade was done in c3cec1eefc9f3b55a3fb7bd623b3d921f493870d, which was included in v6.0.0. Full details of the Libuv issue that induced this are at https://github.com/nodejs/node/issues/6456#issuecomment-219974514 Refs: https://github.com/nodejs/node/pull/1771 Refs: https://github.com/nodejs/node/issues/6456 Refs: https://github.com/nodejs/node/pull/6773 Refs: https://github.com/nodejs/node/pull/6816 PR-URL: https://github.com/nodejs/node/pull/6895 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* Revert "tty: don't read from console stream upon creation"Evan Lucas2016-03-291-7/+1
| | | | | | | | | | | | This reverts commit 461138929498f31bd35bea61aa4375a2f56cceb7. The offending commit broke certain usages of piping from stdin. Fixes: https://github.com/nodejs/node/issues/5927 PR-URL: https://github.com/nodejs/node/pull/5947 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Alexis Campailla <orangemocha@nodejs.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* tty: don't read from console stream upon creationAlexis Campailla2016-03-231-1/+7
| | | | | | | | | | | | | The tty.ReadStream constructor initializes this as a socket, which causes a read to be initiated. Even though during stdin initalization we call readStop shortly after, the read operation can consume keypress events from the system buffers. Fixes: https://github.com/nodejs/node/issues/5384 PR-URL: https://github.com/nodejs/node/pull/5776 Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com> Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
* lib: remove unused modulesRich Trott2015-12-251-1/+0
| | | | | | | | | | Some files in `lib` were using `require` to load modules that were subsequently not used in the file. This removes those `require` statements. PR-URL: https://github.com/nodejs/node/pull/4396 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* tty: Remove deprecated setRawMode wrapperWyatt Preul2015-11-181-10/+0
| | | | | | | PR-URL: https://github.com/nodejs/node/pull/2528 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* lib: Consistent error messages in all modulesmicnic2015-11-091-1/+1
| | | | | | | | This commit fixes some error messages that are not consistent with some general rules which most of the error messages follow. PR-URL: https://github.com/nodejs/node/pull/3374 Reviewed-By: Roman Reiss <me@silverwind.io>
* util: prepend '(node) ' to deprecation messagesSakthipriyan Vairamani2015-07-031-2/+4
| | | | | | | | | | | | | | | | | | | Changes included in this commit are 1. Making the deprecation messages consistent. The messages will be in the following format x is deprecated. Use y instead. If there is no alternative for `x`, then the ` Use y instead.` part will not be there in the message. 2. All the internal deprecation messages are printed with the prefix `(node) `, except when the `--trace-deprecation` flag is set. Fixes: https://github.com/nodejs/io.js/issues/1883 PR-URL: https://github.com/nodejs/io.js/pull/1892 Reviewed-By: Roman Reiss <me@silverwind.io>
* lib,test: fix whitespace issuesRoman Reiss2015-06-151-1/+0
| | | | | PR-URL: https://github.com/nodejs/io.js/pull/1971 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* lib: reduce util.is*() usagecjihrig2015-01-311-3/+2
| | | | | | | | | | | | Many of the util.is*() methods used to check data types simply compare against a single value or the result of typeof. This commit replaces calls to these methods with equivalent checks. This commit does not touch calls to the more complex methods (isRegExp(), isDate(), etc.). Fixes: https://github.com/iojs/io.js/issues/607 PR-URL: https://github.com/iojs/io.js/pull/647 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>