Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindfjeldstad committed Feb 13, 2016
1 parent 28bf78a commit f210e29
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Expand Up @@ -218,19 +218,20 @@ class ImageMagick extends Duplexify {
*/

spawn () {
const onerror = this.onerror.bind(this);
const proc = spawn('convert', this.args());

const stdout = proc.stdout;
stdout.on('error', (e) => this.onerror(e));
stdout.on('error', onerror);
this.setReadable(stdout);

const stdin = proc.stdin;
stdin.on('error', (e) => this.onerror(e));
stdin.on('error', onerror);
this.setWritable(stdin);

const stderr = proc.stderr;
stderr.on('data', this.onerror);
stderr.on('error', (e) => this.onerror(e));
stderr.on('data', onerror);
stderr.on('error', onerror);
}

/**
Expand Down

0 comments on commit f210e29

Please sign in to comment.