Skip to content

Commit 8874c51

Browse files
committed
Disable OPOST
Helps when sharing a tty with non-raw mode processes
1 parent 3be4f09 commit 8874c51

2 files changed

Lines changed: 2 additions & 18 deletions

File tree

lib/readline.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@ exports.createInterface = function(output, completer) {
1717
return new Interface(output, completer);
1818
};
1919

20-
function writeFilter(stream) {
21-
if (stream._writeFiltered) return;
22-
stream._writeFiltered = true;
23-
stream._normalWrite = stream.write;
24-
stream.write = function(d) {
25-
var args = Array.prototype.slice.call(arguments);
26-
if (typeof d == 'string') {
27-
args[0] = d.replace(/([^\r])\n|^\n/g, '$1\r\n');
28-
}
29-
// TODO what about buffers?
30-
return stream._normalWrite.apply(stream, args);
31-
}
32-
}
3320

3421
function Interface(output, completer) {
3522
if (!(this instanceof Interface)) return new Interface(output, completer);
@@ -49,9 +36,6 @@ function Interface(output, completer) {
4936
if (this.enabled) {
5037
// input refers to stdin
5138

52-
writeFilter(this.output);
53-
writeFilter(process.stdout);
54-
5539
// Current line
5640
this.line = '';
5741

src/node_stdio.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static int EnableRawMode(int fd) {
4343
/* input modes: no break, no CR to NL, no parity check, no strip char,
4444
* no start/stop output control. */
4545
raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
46-
/* output modes - disable post processing */
47-
raw.c_oflag &= ~(OPOST);
46+
/* output modes */
47+
raw.c_oflag |= (ONLCR);
4848
/* control modes - set 8 bit chars */
4949
raw.c_cflag |= (CS8);
5050
/* local modes - choing off, canonical off, no extended functions,

0 commit comments

Comments
 (0)