I am new to Ruby and RoR, so pardon me if I ask naive questions.
Ruby on Windows just does not feel right to me. Primarily, I develop in
Linux, mostly in Fedora. Though, I have Ubuntu installed on some
machines as well. I do get stuck in Linux too, mostly due to my lack of
knowledge and experience with Ruby and RoR, but have much better batting
average finding my way around the problems. I have a dual boot machine
with Windows and Fedora. So I decided to go through the “Programming
Ruby” book on the Windows side just for the heck of it – I keep running
into problems that I have no idea how to fix.
Here is another one:
This is a little program out of the PickAxe book (2nd Edition) on page
opfile_name = “C:\RubyPrograms\PickAxeBook\testfile”
socket = $stdin
op_file = File.open(opfile_name, “w”)
# Exceptions raised by this code will
# be caught by the following rescue clause
while data = socket.read(512)
$stderr.print "IO failed: " + $!
When I run it, a nice little DOS window opens up with
C:\ruby\bin\ruby.exe it its title bar and the cursor just waits. I
cannot type, cannot CNTRL-C, except close it by clicking on the top
right hand corner X box. When I do, ruby quits with the following
Exit code: -1073741510
How does one go about debugging this? I can’t even tell which line of
the code the program is hung-up at?
I can see that windows/ruby is creating the testfile in the directory
which has zero bytes. I thought that the line socket = $stdin assigns
standard input to this input stream which we call socket. Therefore, am
I not supposed to be able to type into the Waiting DOS window that opens
up? Is this not the Standard Input?
I haven’t tried to run this in Linux yet, but something tells me that I
am better off in that environment? May be my lack of