Skip to content
Browse files

Fixed error when accessing a non existent directory, now exits properly

  • Loading branch information...
1 parent e5c1e2b commit d598be337758bbaa4b71874388d6d219513461a4 @davglass davglass committed Aug 17, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 javascript/src/cli/CLI-node.js
View
11 javascript/src/cli/CLI-node.js
@@ -4,6 +4,7 @@
*/
var fs = require("fs"),
path = require("path"),
+ exists = fs.existsSync || path.existsSync,
vm = null,
YUITest = require("yuitest"),
stdout = process.stdout,
@@ -53,8 +54,14 @@ YUITest.CLI = {
}
},
- isDirectory: function(name){
- return fs.statSync(name).isDirectory();
+ isDirectory: function(name) {
+ if (exists(name)) {
+ var stat = fs.statSync(name);
+ return stat.isDirectory();
+ } else {
+ this.warn('File Not Found: ' + name);
+ this.quit(1);
+ }
},
getFiles: function(dir){

0 comments on commit d598be3

Please sign in to comment.
Something went wrong with that request. Please try again.