mcculloughsean/clumber — pull request #3 by EndangeredMassa (2014-01-14 21:26:33+00:00)
Title: output better error messages when failing to log with Process

There is a race condition between the child process (for the Process transport) error event and whenever an app tries to write to it. If an app tries to write before the error/open event, it will see an error like:

```
domain.js:66
throw er;
^
Error: write EPIPE
at errnoException (net.js:770:11)
at Object.afterWrite (net.js:594:19)
```

If the error event first first, you will see:

```
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
```

This PR changes the `_write` method to callback with the error instead.

It also adds more information to the child process error, when that occurs, you will see an extra line before the original error that tells you what command caused the error.

```
Error during lumber Process transport: cronolog --symlink=logs/production.log logs/production.log.%Y-%m-%d
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
```