fix error messages in cli

This commit is contained in:
cloudhead
2010-06-04 12:34:41 -04:00
parent 9e8c5860eb
commit 7e03c8f345

View File

@@ -1,4 +1,5 @@
var path = require('path'),
sys = require('sys'),
fs = require('fs');
require.paths.unshift(path.join(__dirname, '..'));
@@ -81,25 +82,25 @@ less.Parser.importer = function (file, paths, callback) {
if (pathname) {
fs.stat(pathname, function (e, stats) {
if (e) process.stdio.writeError(e);
if (e) sys.puts(e);
fs.open(pathname, process.O_RDONLY, stats.mode, function (e, fd) {
if (e) process.stdio.writeError(e);
if (e) sys.puts(e);
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
if (e) process.stdio.writeError(e);
if (e) sys.puts(e);
new(less.Parser)({
paths: [path.dirname(pathname)]
}).parse(data, function (e, root) {
if (e) process.stdio.writeError(e);
if (e) sys.puts(e);
callback(root);
});
});
});
});
} else {
process.stdio.writeError("file '" + file + "' wasn't found.\n");
sys.puts("file '" + file + "' wasn't found.\n");
process.exit(1);
}
}