heapwolf / prompt-sync

a synchronous prompt for node.js
MIT License
211 stars 42 forks source link

False positive in < 0.12 Node.js version check with 4.x and 5.x #11

Closed insin closed 8 years ago

insin commented 8 years ago

For !win32, this version check presumes a 0.x version of Node.js and will give false positives on 4.x and 5.x.

  var fd = process.platform !== 'win32' && +process.version.substr(3) < 12 ? 
    fs.openSync('/dev/tty', 'rs') : 
    process.stdin.fd;

Potential alternative:

Number(/v(\d+\.\d+)/.exec(process.version)[1]) < 0.12
heapwolf commented 8 years ago
Number(/v(\d+\.\d+)/.exec(process.version)[1]) < 0.12

:+1: that seems pretty reasonable, PR?

davidmarkclements commented 8 years ago

fixed