The idea here is to reduce the number of times that `setRawMode()` is called
on the `input` stream, since it is expensive, and simply pause()/resume()
should not call it.
So now `setRawMode()` only gets called at the beginning of the Interface
instance, and then when `Interface#close()` is called.
Test case included.
If the fs.open method is modified via AOP-style extension, in between
the creation of an fs.WriteStream and the processing of its action
queue, then the test of whether or not the method === fs.open will fail,
because fs.open has been replaced.
The solution is to save a reference to fs.open on the stream itself when
the action is placed in the queue.
This fixes isaacs/node-graceful-fs#6.
Technically saying `tty.ReadStream#setRawMode()` is correct,
but since a typical use cannot instantiate `tty.ReadStream` themselves,
and 99% of the time the only instance is `process.stdin`,
then a little clarification seemed necessary.
Instead of allocating a new 64KB buffer each time when checking if there is
something to transform, continue to use the same buffer. Once the buffer is
exhausted, allocate a new buffer. This solves the problem of huge allocations
when small fragments of data are processed, but will also continue to work
well with big pieces of data.
Prevents alignment issues when people create a typed array from a buffer.
Unaligned loads or stores are less efficent and (on some architectures) unsafe.
This should only be minimally used, since the `terminal` value will usually be
what you are expecting. This option is specifically for the case where `terminal`
is false, but you still want colors to be output (or vice-versa).
Previously this was a module-level setting, meaning that all REPL instances
had to share the same writer function. Turning it into one of the options
allows individual REPL instances to use their own writer function.
The overall goal here is to make readline more interoperable with other node
Streams like say a net.Socket instance, in "terminal" mode.
See #2922 for all the details.
Closes #2922.
This reverts commit 443071db57.
Patch was overly compilicated and made some incorrect assumptions about the
position of the cursor being at the bottom of the screen. @rlidwka and I are
working on getting a proper implementation written.
This patch will kill the worker once it has lost its connection with the parent.
However if the worker are doing a suicide, other measures will be used.
This patch add a worker.disconnect() method there will stop the worker from accepting
new connections and then stop the IPC. This allow the worker to die graceful.
When the IPC has been disconnected a 'disconnect' event will emit.
The patch also add a cluster.disconnect() method, this will call worker.disconnect() on
all connected workers. When the workers are disconneted it will then close all server
handlers. This allow the cluster itself to self terminate in a graceful way.
Currently, a child process does not emit the 'exit' event until 'close' events
have been received on all three of the child's stdio streams. This change makes
the child object emit 'exit' when the child exits, and a new 'close' event when
all stdio streams are closed.