mirror of
https://github.com/less/less.js.git
synced 2026-01-23 06:07:56 -05:00
fix error messages in cli
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user