put the dataCallback back for windows reads (#976)

This commit is contained in:
Francis Gulotta 2016-10-21 17:34:09 -04:00 • committed by GitHub
parent 007aef6870
commit 22a369112e

View file

@ -164,6 +164,8 @@ function SerialPort(path, options, callback) {
this.bufferSize = settings.bufferSize;
this.readable = true;
this.reading = false;
} else {
settings.dataCallback = this._emitData.bind(this);
}
this.options = settings;
@ -293,6 +295,11 @@ SerialPort.prototype.write = function(data, callback) {
}.bind(this));
};
SerialPort.prototype._emitData = function(data) {
this.emit('data', data);
};
if (process.platform !== 'win32') {
SerialPort.prototype._read = function() {
if (!this.readable || this.paused || this.reading || this.closing) {
@ -370,11 +377,6 @@ if (process.platform !== 'win32') {
this.pool.used += toRead;
};
SerialPort.prototype._emitData = function(data) {
this.emit('data', data);
};
/**
* Pauses an open connection (unix only)
*/