[BUG?] Tempfile

Hi,

it seems that using tempfile.rb (ruby 1.7.3 from PragProg installer)
with binary files does fail on Windows (because of the missing “b” flag
when the file is opened for writing).

I suppose the line

@tmpfile = File.open(tmpname, File::RDWR|File::CREAT|File::EXCL, 0600)

in tempfile.rb is the guilty as replacing the ‘FILE::…,0600’ by ‘bw+’ solves
the problem.

Is there a workaround ? (a File::BINARY?)

Thanks in advance,

···


Pierre Baillet
There is something to be learned from a rainstorm. When meeting with a sudden
shower, you try not to get wet and run quickly along the road. But doing such
things as passing under the eaves of houses, you still get wet. When you are
resolved from the beginning, you will not be perplexed, though you still get
the same soaking. This understanding extends to everything.
Ghost Dog - The Way of the Samouraï

Hi,

···

In message “[BUG?] Tempfile” on 03/01/03, Pierre Baillet oct@zoy.org writes:

it seems that using tempfile.rb (ruby 1.7.3 from PragProg installer)
with binary files does fail on Windows (because of the missing “b” flag
when the file is opened for writing).

How about calling “binmode” to the tempfile object?

t = Tempfile.new(“foo”)
t.binmode

						matz.

Hello,

···

On Fri, Jan 03, 2003, Yukihiro Matsumoto wrote:

In message “[BUG?] Tempfile” > on 03/01/03, Pierre Baillet oct@zoy.org writes:

it seems that using tempfile.rb (ruby 1.7.3 from PragProg installer)
with binary files does fail on Windows (because of the missing “b” flag
when the file is opened for writing).

How about calling “binmode” to the tempfile object?

t = Tempfile.new(“foo”)
t.binmode

Thanks a lot !


Pierre Baillet
Debian - What your mom would use if it were twenty times easier.
http://www.copyleft.net