Merge pull request #213 from twbs/saner-stdin

Use more common way to determine if stdin should be read
This commit is contained in:
Heinrich Fenkart 2015-02-22 00:38:13 +01:00
Родитель ed63aa2b81 db804a9186
Коммит bb705ba43d
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -17,8 +17,8 @@ program
return val.split(',');
})
.parse(process.argv);
var disabledIds = program.disable === undefined ? [] : program.disable;
var disabledIds = program.disable === undefined ? [] : program.disable;
var totalErrCount = 0;
var totalFileCount = 0;
var lintedFiles = [];
@ -44,7 +44,7 @@ function buildReporter(origin) {
function handleStdin() {
return new Deferred(function (resolve) {
if (typeof process.stdin.isTTY !== 'boolean' || process.stdin.isTTY) {
if (process.stdin.isTTY) {
return resolve();
}
@ -79,11 +79,15 @@ function handlePath(pattern) {
});
}
if (!program.args.length) {
program.args.push('-');
}
program.args.forEach(function (pattern) {
lintedFiles.push(handlePath(pattern));
lintedFiles.push(pattern === '-' ? handleStdin() : handlePath(pattern));
});
Deferred.join(handleStdin(), Deferred.all(lintedFiles)).then(function () {
Deferred.all(lintedFiles).then(function () {
console.log("");
if (totalErrCount > 0) {