HomePhorge

Make `binwrite` emulation work on Windows.
fc595ff576edUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Make binwrite emulation work on Windows.

So, it turns out that Ruby on Windows is pretty damn awesome, and that to
successfully sysopen a file, then use it as an IO, you need to write this:

IO.new(IO::sysopen(filename, mode), mode) {|io| ... }

...yes, indeed, you need to repeat the mode, and pass the sysopen mode - which
is completely incompatible with the normal open. It works when you pass a
file descriptor from sysopen, though, and gets Ruby convinced to use it right.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>

Details

Provenance
Daniel Pittman <daniel@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU73e302bbf5ab: Use Win32 API atomic replace in `replace_file`
Branches
Unknown
Tags
Unknown

Event Timeline

Daniel Pittman <daniel@puppetlabs.com> committed rPUfc595ff576ed: Make `binwrite` emulation work on Windows. (authored by Daniel Pittman <daniel@puppetlabs.com>).Apr 19 2012, 12:08 AM