Open dazhazit opened 9 years ago
One unit test fail on one version of node and we have a pull failure? No offence but the unit tests would never have passed on v0.8.28 with even the original master as AFAIK stream.end() does not accept a function in that version. So I guess it's time to bugfix the unit tests too? http://nodejs.org/docs/v0.8.28/api/stream.html#stream_stream_end_string_encoding
I assume this is a case such as sending command EL will crash the host? It's better to add the handling for these then to swallow the error.
;['eof','susp','abort','ec','el'].forEach(function (command) { var code = COMMANDS[command.toUpperCase()] COMMAND_IMPLS[code] = function (bufs, i, event) { // Needs to be converted to a NOP, we don't want to act on it. event.buf = bufs.splice(0, i).toBuffer() event.data = Buffer([ 241 ]) return event } })
Really, additional linemode support should be added; but this code will prevent crashes. I also agree about the unit tests. Due to lack of reply, a fork is probably in order.
I've been waiting for a few months for a fix to this so I did it myself. OK, try/catch could have been used but it seemed a cleaner solution to put in guard code where the crash is happening and just ignore the command code or option code entirely.