Browse Source

process: fix permanent deoptimizations

PR-URL: https://github.com/nodejs/node/pull/12456
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Brian White 8 years ago
parent
commit
a641b7cf3e
No known key found for this signature in database GPG Key ID: 606D7358F94DA209
  1. 12
      lib/internal/process/stdio.js

12
lib/internal/process/stdio.js

@ -51,7 +51,7 @@ function setupStdio() {
switch (tty_wrap.guessHandleType(fd)) { switch (tty_wrap.guessHandleType(fd)) {
case 'TTY': case 'TTY':
const tty = require('tty'); var tty = require('tty');
stdin = new tty.ReadStream(fd, { stdin = new tty.ReadStream(fd, {
highWaterMark: 0, highWaterMark: 0,
readable: true, readable: true,
@ -60,13 +60,13 @@ function setupStdio() {
break; break;
case 'FILE': case 'FILE':
const fs = require('fs'); var fs = require('fs');
stdin = new fs.ReadStream(null, { fd: fd, autoClose: false }); stdin = new fs.ReadStream(null, { fd: fd, autoClose: false });
break; break;
case 'PIPE': case 'PIPE':
case 'TCP': case 'TCP':
const net = require('net'); var net = require('net');
// It could be that process has been started with an IPC channel // It could be that process has been started with an IPC channel
// sitting on fd=0, in such case the pipe for this fd is already // sitting on fd=0, in such case the pipe for this fd is already
@ -152,20 +152,20 @@ function createWritableStdioStream(fd) {
switch (tty_wrap.guessHandleType(fd)) { switch (tty_wrap.guessHandleType(fd)) {
case 'TTY': case 'TTY':
const tty = require('tty'); var tty = require('tty');
stream = new tty.WriteStream(fd); stream = new tty.WriteStream(fd);
stream._type = 'tty'; stream._type = 'tty';
break; break;
case 'FILE': case 'FILE':
const fs = require('internal/fs'); var fs = require('internal/fs');
stream = new fs.SyncWriteStream(fd, { autoClose: false }); stream = new fs.SyncWriteStream(fd, { autoClose: false });
stream._type = 'fs'; stream._type = 'fs';
break; break;
case 'PIPE': case 'PIPE':
case 'TCP': case 'TCP':
const net = require('net'); var net = require('net');
stream = new net.Socket({ stream = new net.Socket({
fd: fd, fd: fd,
readable: false, readable: false,

Loading…
Cancel
Save