diff --git a/bin/lessc b/bin/lessc index 02be342..c2b1628 100755 --- a/bin/lessc +++ b/bin/lessc @@ -68,6 +68,7 @@ fs.stat(input, function (e, stats) { }).parse(data, function (err, tree) { if (err) { less.writeError(err); + process.exit(1); } else { try { css = tree.toCSS({ compress: options.compress }); @@ -79,6 +80,7 @@ fs.stat(input, function (e, stats) { } } catch (e) { less.writeError(e); + process.exit(2); } } }); diff --git a/lib/less/index.js b/lib/less/index.js index a103d77..e01efb8 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -40,7 +40,7 @@ var less = { var error = []; if (ctx.stack) { - return require('sys').puts(ctx.stack); + return require('sys').error(ctx.stack); } if (typeof(extract[0]) === 'string') { @@ -56,8 +56,8 @@ var less = { } error = error.join('\n') + '\033[0m\n'; - require('sys').puts(stylize(ctx.message + ' of ', 'red') + - ctx.filename + ': ', error); + require('sys').error(stylize(ctx.message + ' of ', 'red') + + ctx.filename + ': ', error); } }; @@ -87,13 +87,13 @@ less.Parser.importer = function (file, paths, callback) { if (pathname) { fs.stat(pathname, function (e, stats) { - if (e) sys.puts(e); + if (e) sys.error(e); fs.open(pathname, process.O_RDONLY, stats.mode, function (e, fd) { - if (e) sys.puts(e); + if (e) sys.error(e); fs.read(fd, stats.size, 0, "utf8", function (e, data) { - if (e) sys.puts(e); + if (e) sys.error(e); new(less.Parser)({ paths: [path.dirname(pathname)], @@ -106,7 +106,7 @@ less.Parser.importer = function (file, paths, callback) { }); }); } else { - sys.puts("file '" + file + "' wasn't found.\n"); + sys.error("file '" + file + "' wasn't found.\n"); process.exit(1); } }