 fd;

    // stdin starts out life in a paused state, but node doesn't
    // know yet.  Explicitly to readStop() it to put it in the
    // not-reading state.
    if (stdin._handle && stdin._handle.readStop) {
      stdin._handle.reading = false;
      stdin._readableState.reading = false;
      stdin._handle.readStop();
    }

    // if the user calls stdin.pause(), then we need to stop reading
    // immediately, so that the process can close down.
    stdin.on('pause', () => {
      if (!stdin._handle)
        return;
      stdin._readableState.reading = false;
      stdin._handle.reading = false;
      stdin._handle.readStop();
    });

    return stdin;
  }

  Object.defineProperty(process, 'stdout', {
    configurable: true,
    enumerable: true,
    get: getStdout
  });

  Object.defineProperty(process, 'stderr', {
    configurable: true,
    enumerable: true,
    get: getStderr
  });

  Object.defineProperty(process, 'stdin', {
    configurable: true,
    enumerable: true,
    get: getStdin
  });

  process.openStdin = function() {
    process.stdin.resume();
    return process.stdin;
  };
}

function createFallbackStream() {
  var Writable = process.NativeModule.require('stream').Writable;
  var stream = new Writable;
  stream.isTTY = false;
  stream._write = function(chunk, encoding, callback) {
    if (process.platform === 'win32' &&
        process.env.ELECTRON_RUN_AS_NODE &&
        !process.env.ELECTRON_NO_ATTACH_CONSOLE) {
      process.log(chunk.toString());
    }
    process.nextTick(callback);
  };
  return stream;
}

function createWritableStdioStream(fd) {
  var stream;
  const tty_wrap = process.binding('tty_wrap');

  // Note stream._type is used for test-module-load-list.js

  try {
  switch (tty_wrap.guessHandleType(fd)) {
    case 'TTY':
      var tty = require('tty');
      stream = new tty.WriteStream(fd);
      stream._type = 'tty';
      break;

    case 'FILE':
      var fs = require('internal/fs');
      stream = new fs.SyncWriteStream(fd, { autoClose: false });
      stream._type = 'fs';
      break;

    case 'PIPE':
    case 'TCP':
      var net = require('net');
      stream = new net.Socket({
        fd: fd,
        readable: false,
        writable: true
      });
      stream._type = 'pipe';
      break;

    default:
      // Probably an error on in uv_guess_handle()
      throw new errors.Error('ERR_UNKNOWN_STREAM_TYPE');
  }
  // Ignore stream errors.
  stream.on('error', function() {});
  } catch (error) {
    stream = createFallbackStream();
  }

  // For supporting legacy API we put the FD here.
  stream.fd = fd;

  stream._isStdio = true;

  return stream;
}

}.call(this, exports, require, module, __filename, __dirname); });