summaryrefslogtreecommitdiff
path: root/lib/tty.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-12-31 00:27:56 +0100
committerAnna Henningsen <anna@addaleax.net>2018-01-14 14:41:11 +0100
commit8b751f7eb7b05a0b27f52e2288a636fdd78e9ecb (patch)
tree1c1040fbf33fa73344e0ee152c12ad7695f92f4c /lib/tty.js
parentc84582cbb6362fa8b2eb2d3bc153617fef2982d1 (diff)
downloadandroid-node-v8-8b751f7eb7b05a0b27f52e2288a636fdd78e9ecb.tar.gz
android-node-v8-8b751f7eb7b05a0b27f52e2288a636fdd78e9ecb.tar.bz2
android-node-v8-8b751f7eb7b05a0b27f52e2288a636fdd78e9ecb.zip
process: use more direct sync I/O for stdio
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>
Diffstat (limited to 'lib/tty.js')
-rw-r--r--lib/tty.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/tty.js b/lib/tty.js
index 2a62fcb859..28f2a41184 100644
--- a/lib/tty.js
+++ b/lib/tty.js
@@ -24,6 +24,7 @@
const util = require('util');
const net = require('net');
const { TTY, isTTY } = process.binding('tty_wrap');
+const { makeSyncWrite } = require('internal/net');
const { inherits } = util;
const errnoException = util._errnoException;
const errors = require('internal/errors');
@@ -91,6 +92,8 @@ function WriteStream(fd) {
// even though it was originally intended to change in v1.0.2 (Libuv 1.2.1).
// Ref: https://github.com/nodejs/node/pull/1771#issuecomment-119351671
this._handle.setBlocking(true);
+ this._writev = null;
+ this._write = makeSyncWrite(fd);
var winSize = new Array(2);
var err = this._handle.getWindowSize(winSize);