remove timeout on stdin

This commit is contained in:
Eugene Sharygin 2015-06-08 14:35:39 +03:00
parent 99a8cfe6fb
commit 71dfe2e7a3
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);
});