src: fix StringBytes::Write if string is external

Signed-off-by: Fedor Indutny <fedor@indutny.com>
node: remove duplicate tickInfo assignment

When process._setupNextTick() was introduced as the means to properly
initialize the mechanism behind process.nextTick() a chunk of code was
left behind that assigned memory to process._tickInfo. This code is no
longer needed.
src: fix spelling mistake

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
readline: fix close event of readline.Interface()

Not removing 'end' listeners for input and output on the 'close' event
resulted in an EventEmitter related memory leak.

This issue also might be reproduced at:
https://github.com/npm/npm/issues/5203

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
buffer: remove Buffer#toArrayBuffer()

A recent change to v8's API now makes it impossible to memcpy to a
v8::ArrayBuffer without causing it to be externalized. This means that
the garbage collector will not automatically free the memory when the
object is collected.

When/If the necessary API is included to allow the above
Buffer#toArrayBuffer() will be reintroduced.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
test: fixes test/disabled/test-readline.js

This test is still in test/disabled because it requires a tty, however
when executed directly this test now passes.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
tls_wrap: remove unused variable
readline: implements keypress buffering

There was an underlying assumption in readline.emitKeypressEvents (and
by extension emitKey) that the given stream (usually process.stdin)
would emit 'data' once per keypress, which is not always the case.

This commit buffers the input stream and ensures a 'keypress' event is
triggered for every keypress (including escape codes).

Signed-off-by: Fedor Indutny <fedor@indutny.com>
fs: add consistent flag fall throughs

stringToFlags() has fall throughs in a case statement.
However, they are not consistently implemented. This commit adds
consistency.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
test: rewrite spawnsync test

The spawnsync test was written wrong, the timeout can never fire before
the sync process has returned, the delta is immaterial and times when
it was succeeding are not reliable cases.

Instead verify that the timeout doesn't fire while the sync process is
happening.