From 8874c51d0465d80c9296cdd55b6eb17de49253db Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 22 Dec 2010 23:31:06 -0800 Subject: [PATCH] Disable OPOST Helps when sharing a tty with non-raw mode processes --- lib/readline.js | 16 ---------------- src/node_stdio.cc | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/lib/readline.js b/lib/readline.js index 3ae43f4735..4a0565a40a 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -17,19 +17,6 @@ exports.createInterface = function(output, completer) { return new Interface(output, completer); }; -function writeFilter(stream) { - if (stream._writeFiltered) return; - stream._writeFiltered = true; - stream._normalWrite = stream.write; - stream.write = function(d) { - var args = Array.prototype.slice.call(arguments); - if (typeof d == 'string') { - args[0] = d.replace(/([^\r])\n|^\n/g, '$1\r\n'); - } - // TODO what about buffers? - return stream._normalWrite.apply(stream, args); - } -} function Interface(output, completer) { if (!(this instanceof Interface)) return new Interface(output, completer); @@ -49,9 +36,6 @@ function Interface(output, completer) { if (this.enabled) { // input refers to stdin - writeFilter(this.output); - writeFilter(process.stdout); - // Current line this.line = ''; diff --git a/src/node_stdio.cc b/src/node_stdio.cc index ad098352b9..3c4c3b584c 100644 --- a/src/node_stdio.cc +++ b/src/node_stdio.cc @@ -43,8 +43,8 @@ static int EnableRawMode(int fd) { /* input modes: no break, no CR to NL, no parity check, no strip char, * no start/stop output control. */ raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); - /* output modes - disable post processing */ - raw.c_oflag &= ~(OPOST); + /* output modes */ + raw.c_oflag |= (ONLCR); /* control modes - set 8 bit chars */ raw.c_cflag |= (CS8); /* local modes - choing off, canonical off, no extended functions,