Skip to content

Commit

Permalink
use isFIFO() instead to more narrowly target <() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Mar 29, 2013
1 parent c396065 commit 790cdf5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function resolve (x, opts, cb) {
fs.stat(file, function (err, stat) {
if (err && err.code === 'ENOENT') cb(null, false)
else if (err) cb(err)
else cb(null, !stat.isDirectory())
else cb(null, stat.isFile() || stat.isFIFO())
});
};
var readFile = opts.readFile || fs.readFile;
Expand Down
5 changes: 3 additions & 2 deletions lib/sync.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
var core = require('./core');
var fs = require('fs');
var path = require('path');
var existsSync = fs.existsSync || path.existsSync;

module.exports = function (x, opts) {
if (core[x]) return x;

if (!opts) opts = {};
var isFile = opts.isFile || function (file) {
return existsSync(file) && !fs.statSync(file).isDirectory()
try { var stat = fs.statSync(file) }
catch (err) { if (err && err.code === 'ENOENT') return false }
return stat.isFile() || stat.isFIFO();
};
var readFileSync = opts.readFileSync || fs.readFileSync;

Expand Down

0 comments on commit 790cdf5

Please sign in to comment.