Skip to content

Commit

Permalink
Disable OPOST
Browse files Browse the repository at this point in the history
Helps when sharing a tty with non-raw mode processes
  • Loading branch information
ry committed Dec 30, 2010
1 parent 3be4f09 commit 8874c51
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
16 changes: 0 additions & 16 deletions lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 = '';

Expand Down
4 changes: 2 additions & 2 deletions src/node_stdio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8874c51

Please sign in to comment.