Merge pull request #11 from eush77/no-timeout

Remove timeout on stdin
This commit is contained in:
AJ ONeal 2016-04-18 22:53:20 -06:00
commit 2906e8e989
1 changed files with 2 additions and 10 deletions

12
cli.js
View File

@ -59,23 +59,15 @@
function readStdin() {
var text = ''
, timeoutToken
, stdin = process.stdin
;
stdin.resume();
// how to tell piping vs waiting for user input?
timeoutToken = setTimeout(function () {
cb(new Error('no stdin data'));
stdin.pause();
}, 1000);
stdin.on('data', function (chunk) {
clearTimeout(timeoutToken);
text += chunk;
});
stdin.on('end', function () {
cb(null, text);
});