diff --git a/lib/readline-sync.js b/lib/readline-sync.js index e38f8cf..f1f6dcf 100644 --- a/lib/readline-sync.js +++ b/lib/readline-sync.js @@ -80,11 +80,22 @@ function _readlineSync(options) { return fsB; } + function getVerNum(ver) { + var nums = ver.replace(/^\D+/, '').split('.'); + var verNum = 0; + if ((nums[0] = +nums[0])) { verNum += nums[0] * 10000; } + if ((nums[1] = +nums[1])) { verNum += nums[1] * 100; } + if ((nums[2] = +nums[2])) { verNum += nums[2]; } + return verNum; + } + if (typeof fdR !== 'string') { return; } fdR = null; if (IS_WIN) { - if (process.stdin.isTTY) { + // iojs-v2.3.2+ input stream can't read first line. (#18) + // ** Don't get process.stdin before check! ** + if (getVerNum(process.version) < 20302 && process.stdin.isTTY) { process.stdin.pause(); fdR = process.stdin.fd; ttyR = process.stdin._handle; diff --git a/package.json b/package.json index 4729060..9a4d4ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "readline-sync", - "version": "1.2.19", + "version": "1.2.20", "title": "readlineSync", "description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).", "keywords": [