hybridgroup / rubyserial

FFI Ruby library for RS-232 serial port communication
https://rubygems.org/gems/rubyserial
Other
154 stars 27 forks source link

Serial#gets("\r") does not work with ruby 1.9.3 and Windows #17

Closed swabianeagle closed 9 years ago

swabianeagle commented 9 years ago

In ruby 1.9.3 String#bytes returns an enumerator, not an array as in ruby 2.1. Because of that the first condition in line 86 in windows.rb will never return true.

The following slight modification to line 86 in windows.rb will make the code work with 1.9.3 as well: break if (bytes.last(sep.bytes.to_a.size) == sep.bytes.to_a) || ((bytes.size == limit) if limit)

zankich commented 9 years ago

@swabianeagle ruby 1.9.3 is scheduled to be EOL'd next month, https://www.ruby-lang.org/en/news/2014/01/10/ruby-1-9-3-will-end-on-2015/, so we may entirely drop support for 1.9.3.

The windows rubyinstaller supports both 2.0 and 2.1, so I would suggest upgrading to at lest 2.0.

@deadprogram thought's on dropping support for 1.9.3?