Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

handle child_proc error when using buffer input

closes #109
  • Loading branch information...
commit 795734c1afe61b0ce626dc1e50014fcb092d60aa 1 parent 2bdbbd5
@aheckmann authored
Showing with 13 additions and 11 deletions.
  1. +13 −11 lib/command.js
View
24 lib/command.js
@@ -183,7 +183,19 @@ module.exports = function (proto) {
debug(cmd);
- if (this.sourceBuffer) {
+ if (self.sourceBuffer || self.sourceStream) {
+ // handle streaming errors when gm/imageMagick is not installed
+ proc.stdin.on('error', handlerr);
+ proc.stdout.on('error', handlerr);
+ function handlerr (err) {
+ if ('EPIPE' == err.code && 'write' == err.syscall) {
+ err.message = missingBinMsg(self) + err.message;
+ }
+ cb(self, err);
+ }
+ }
+
+ if (self.sourceBuffer) {
proc.stdin.write(this.sourceBuffer);
proc.stdin.end();
} else if (self.sourceStream) {
@@ -195,16 +207,6 @@ module.exports = function (proto) {
return cb(self, err);
}
- // handle streaming errors when gm/imageMagick is not installed
- proc.stdin.on('error', handlerr);
- proc.stdout.on('error', handlerr);
- function handlerr (err) {
- if ('EPIPE' == err.code && 'write' == err.syscall) {
- err.message = missingBinMsg(self) + err.message;
- }
- cb(self, err);
- }
-
self.sourceStream.pipe(proc.stdin);
// resume any buffered events from a previous identify operation
Please sign in to comment.
Something went wrong with that request. Please try again.