2007/11/2, Brandon Casci <brandon / loudcity.net>:
> Ok....I confirmed this a few different ways. It may be a new bug.
>
> On windows, you can't send binary data from a file over to another
> system pipe. It blows up. It will work from a network socket to a system
> pipe, and it will work from a local text file to a system pipe, but not
> from a binary file to a system pipe.

Few remarks: if you post code then you should people give at least the
chance to understand what's going on.  In your first posting it was
not clear from the code shown what @ezstream is.

Note that there is no #read method which will accept a binary flag.
Instead the portion read is put into the string provided.  In your
case this leads to unnecessary string creations that get overwritten
immediately ('rb' will create a new string each time it is executed).

Then, did you consider decreasing the buffer size?  16,000 seems quite
high. I'd start with 1,024.

Also, the looping can be done more elegantly:

while ( chunk = r.read(1024) )
  ...
end

If you want to be even more savvy you can do

chunk = ""
while r.read(1024, chunk)
  ...
end

Cheers

robert

-- 
use.inject do |as, often| as.you_can - without end