xavi-/node-copy-paste — pull request #6 by CMTegner (2013-08-20 22:28:40+00:00)
Title: Preventing stderr.on("end") from invoking the callback when no error has occurred

The `stderr.on("end")` handler was set up to join the `err` array and use the resulting string as the first argument to the optional callback, regardless of whether or not `err` actually had any entries. This was causing the callback to be invoked twice: once for the actual success, and once for the false positive error message.

This change makes sure that there has been at least one `data` event on `stderr` before invoking the callback, removing any false positives.