Blocked by #522
Our current implementation of common.error() works well for the common case, but could be extended to work much better for edge cases. I've been working on a replacement for exec, but I ran into some issues with getting the error calls just right.
If you look at how exec() is currently implemented, its error output looks like this:
> shell.exec('git status'); // git's natural error message makes sense
fatal: Not a git repository...
> console.log(shell.error()); // but this should ideally be the same
exec:
We can modify exec() to get things perhaps a little better, but without changing common.error(), the best we can get is this:
> shell.exec('git status'); // Now the error message prints twice
fatal: Not a git repository...
exec: fatal: Not a git repository...
> console.log(shell.error()); // We see the real error message, but with a prefix
exec: fatal: Not a git repository...
I think the necessary options would be:
prefix: false: don't insert the command name as a prefix (it isn't natural to see the prefix exec: in front of the external command's error message)
print: false: don't print the error message to the console (if the external command is already writing it to the console, this doesn't really make sense)