diff --git a/clite/core.js b/clite/core.js index 01d75e2..e622620 100644 --- a/clite/core.js +++ b/clite/core.js @@ -1317,11 +1317,15 @@ clite.shell = { if (args.length > 1) { dir = clite.lib.resolvePath(args[1]); } - var fd = clite.io.open(dir); + var fd = clite.io.open(dir,false); if (!fd) { io.error('invalid directory: '+dir); return; } + if (!fd.node.data.isdir) { + io.error('invalid directory: '+dir); + return; + } clite.io.close(fd); clite.shell.env.PWD = dir; clite.shell.prompt.generate(); @@ -1341,7 +1345,7 @@ clite.shell = { return; }else{ var path = clite.shell.resolvePath(args[1]); - var fd = clite.io.open(path); + var fd = clite.io.open(path,false); if (!fd) return; clite.io.close(fd); @@ -1355,7 +1359,7 @@ clite.shell = { io.write(args[1]+' is a shell builtin'); }else{ var path = clite.shell.resolvePath(args[1]); - var fd = clite.io.open(path); + var fd = clite.io.open(path,false); if (!fd) return; clite.io.close(fd);