{"action":"created","issue":{"url":"https://api.github.com/repos/hybridgroup/rubyserial/issues/21","labels_url":"https://api.github.com/repos/hybridgroup/rubyserial/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/hybridgroup/rubyserial/issues/21/comments","events_url":"https://api.github.com/repos/hybridgroup/rubyserial/issues/21/events","html_url":"https://github.com/hybridgroup/rubyserial/issues/21","id":54806734,"number":21,"title":"Serial doesn't play nice with File on Win8","user":{"login":"bfoz","id":65124,"avatar_url":"https://avatars.githubusercontent.com/u/65124?v=3","gravatar_id":"","url":"https://api.github.com/users/bfoz","html_url":"https://github.com/bfoz","followers_url":"https://api.github.com/users/bfoz/followers","following_url":"https://api.github.com/users/bfoz/following{/other_user}","gists_url":"https://api.github.com/users/bfoz/gists{/gist_id}","starred_url":"https://api.github.com/users/bfoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfoz/subscriptions","organizations_url":"https://api.github.com/users/bfoz/orgs","repos_url":"https://api.github.com/users/bfoz/repos","events_url":"https://api.github.com/users/bfoz/events{/privacy}","received_events_url":"https://api.github.com/users/bfoz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-19T20:09:10Z","updated_at":"2015-01-22T18:36:11Z","closed_at":null,"body":"I'm working on a simple script to send a data file to a microcontroller and then display whatever the micro sends back. The current test-firmware simply echoes every byte that it gets over the UART, but ultimately it's supposed to process the bytes and return the results.\r\n\r\nIt seems that if I open the serial port before opening the data file, the port gets hung up. But, if I read the file into memory, and close it, before opening the port, everything works fine. \r\n\r\nI'm probably doing something wrong here, but I'm not seeing it. Any ideas?\r\n\r\nThis is the script that doesn't work...\r\n```ruby\r\nrequire 'rubyserial'\r\n\r\nputs \"Hello world\"\r\n\r\nserialport = Serial.new 'COM4', 125000\r\n\r\nThread.new do\r\n\tloop { printf(\"%c\", serialport.read(1)) }\r\nend\r\n\r\nFile.open('data/sim-data-01.txt') {|f|}\r\n\r\n5.times { serialport.write('a') }\t# This should be echoed by the micro\r\n\r\nloop do \r\nend\r\n```\r\n\r\nBut, this version works just fine...\r\n```ruby\r\nrequire 'rubyserial'\r\n\r\nputs \"Hello world\"\r\n\r\nFile.open('data/sim-data-01.txt') {|f|}\r\n\r\nserialport = Serial.new 'COM4', 125000\r\n\r\nThread.new do\r\n\tloop { printf(\"%c\", serialport.read(1)) }\r\nend\r\n\r\n5.times { serialport.write('a') }\t# This should be echoed by the micro\r\n\r\nloop do\r\nend\r\n```\r\n\r\nThe only difference between the two is the location of the call to File.open.\r\n\r\nHere's the output of `ruby -v`:\r\nruby 2.1.5p273 (2014-11-13 revision 48405) [x64-mingw32]\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/hybridgroup/rubyserial/issues/comments/71072869","html_url":"https://github.com/hybridgroup/rubyserial/issues/21#issuecomment-71072869","issue_url":"https://api.github.com/repos/hybridgroup/rubyserial/issues/21","id":71072869,"user":{"login":"bfoz","id":65124,"avatar_url":"https://avatars.githubusercontent.com/u/65124?v=3","gravatar_id":"","url":"https://api.github.com/users/bfoz","html_url":"https://github.com/bfoz","followers_url":"https://api.github.com/users/bfoz/followers","following_url":"https://api.github.com/users/bfoz/following{/other_user}","gists_url":"https://api.github.com/users/bfoz/gists{/gist_id}","starred_url":"https://api.github.com/users/bfoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfoz/subscriptions","organizations_url":"https://api.github.com/users/bfoz/orgs","repos_url":"https://api.github.com/users/bfoz/repos","events_url":"https://api.github.com/users/bfoz/events{/privacy}","received_events_url":"https://api.github.com/users/bfoz/received_events","type":"User","site_admin":false},"created_at":"2015-01-22T18:36:11Z","updated_at":"2015-01-22T18:36:11Z","body":"Thanks. That's essentially what I've done, but I was hoping for something less reliant on polling."}}