aheckmann/gm — pull request #330 by dsign (2014-10-16 05:47:02+00:00)
Title: Handle empty buffers

- Empty streams/buffers are present sometimes if an invoked process
returns with an error code. In the current architecture, callback
functions can receive streams, which are available before the
process exits and delivers an exit code. The callback can thus not
be informed of the error condition by the library and has to find out
herself. This commit fixes a case when the callback is provided by
the library, so that empty streams are reported as errors.
- streamToUnemptyBuffer checks the length of the buffer before
delivering it, and if the buffer has a zero length, an error is
delivered instead. This behavior is probably good for all the cases
where streamToBuffer is used in this library, so I'm also dropping that as a
dependency.
- Added a test case. All tests passing.
- Fixes #299