fixes #1633: error output when using `coffee -e`

This commit is contained in:
Michael Ficarra 2011-08-27 13:21:03 -04:00
parent 539b872e02
commit b4e2240ede
2 changed files with 2 additions and 2 deletions

View File

@ -141,7 +141,7 @@
CoffeeScript.emit('failure', err, task); CoffeeScript.emit('failure', err, task);
if (CoffeeScript.listeners('failure').length) return; if (CoffeeScript.listeners('failure').length) return;
if (o.watch) return printLine(err.message); if (o.watch) return printLine(err.message);
printWarn(err.stack); printWarn(err instanceof Error && err.stack || ("ERROR: " + err));
return process.exit(1); return process.exit(1);
} }
}; };

View File

@ -140,7 +140,7 @@ compileScript = (file, input, base) ->
CoffeeScript.emit 'failure', err, task CoffeeScript.emit 'failure', err, task
return if CoffeeScript.listeners('failure').length return if CoffeeScript.listeners('failure').length
return printLine err.message if o.watch return printLine err.message if o.watch
printWarn err.stack printWarn err instanceof Error and err.stack or "ERROR: #{err}"
process.exit 1 process.exit 1
# Attach the appropriate listeners to compile scripts incoming over **stdin**, # Attach the appropriate listeners to compile scripts incoming over **stdin**,