brenden / node-webshot

Easy website screenshots in Node.js
2.12k stars 285 forks source link

Incorrect 'this' reference in stream mode #63

Closed artemverbo closed 10 years ago

artemverbo commented 10 years ago

Hi, I have an error and believe that "this" reference is incorrect in stream mode this.kill(); Having the following error when webshot is failing in stream mode due to PhantomJS crash:

TypeError: Object # has no method 'kill'
phantomProc.stderr.on('data', function(data) {
      clearTimeout(timeoutID);
      cb(new Error(data));
      this.kill();
    });

    phantomProc.on('exit', function() {
      s.emit('end');
      this.kill();
    });