Skip to content

Commit

Permalink
Fixes placement of error message that got broken when moving code aro…
Browse files Browse the repository at this point in the history
…und (oops)
  • Loading branch information
thiagoarrais committed Apr 5, 2011
1 parent 0b2eaca commit 962cf05
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions imagemagick.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ function exec2(file, args /*, options, callback */) {
proc.on = proc.emitter.on.bind(proc.emitter);
this.out = proc.emitter.emit.bind(proc.emitter, 'data');
this.err = this.stderr.out.bind(this.stderr);
this.errCurrent = this.stderr.current.bind(this.stderr);
};
Wrapper.prototype.finish = function(err) {
this.proc.emitter.emit('end', err, this.stderr.current());
this.proc.emitter.emit('end', err, this.errCurrent());
};

var Accumulator = function(cb) {
Expand All @@ -55,7 +56,8 @@ function exec2(file, args /*, options, callback */) {
this.out = limitedWrite(this.stdout);
this.err = limitedWrite(this.stderr);
};
Accumulator.prototype.current = function() { return this.stdout.contents; }
Accumulator.prototype.current = function() { return this.stdout.contents; };
Accumulator.prototype.errCurrent = function() { return this.stderr.contents; };
Accumulator.prototype.finish = function(err) { this.callback(err, this.stdout.contents, this.stderr.contents); };

var std = callback ? new Accumulator(callback) : new Wrapper(child);
Expand Down Expand Up @@ -83,7 +85,7 @@ function exec2(file, args /*, options, callback */) {
if (code === 0 && signal === null) {
std.finish(null);
} else {
var e = new Error("Command "+(timedOut ? "timed out" : "failed")+": " + stderr);
var e = new Error("Command "+(timedOut ? "timed out" : "failed")+": " + std.errCurrent());
e.timedOut = timedOut;
e.killed = killed;
e.code = code;
Expand Down

0 comments on commit 962cf05

Please sign in to comment.