var fs = require('fs')
var keypress = require('keypress')
var ReadStream = require('tty').ReadStream

module.exports = openTTY

function openTTY() {
    var tty = new ReadStream(fs.openSync('/dev/tty', 'r'))
    tty.setRawMode(true)
    keypress(tty)

    return tty
}

var process = require('process')
var fs = require('fs')
var keypress = require('keypress')
var ReadStream = require('tty').ReadStream
var _fs = process.binding('fs')
var _constants = process.binding('fs')

module.exports = openTTY

function openTTY() {
    var fd
    // wtf hack
    if (process.platform === 'win32') {
        fd = _fs.open('CON:', _constants.RDONLY, 438)
    } else {
        fd = fs.openSync('/dev/tty', 'r')
    }

    var tty = new ReadStream(fd)
    tty.setRawMode(true)
    keypress(tty)

    return tty
}

add windows hack for TTY