On 22 Jul 2010, at 15:59, Justin Fitzsimmons wrote:

> Backport #3602: stdout not set in rubyw.exe, causes silent failures
> http://redmine.ruby-lang.org/issues/show/3602
>=20
> Author: Justin Fitzsimmons
> Status: Open, Priority: Normal
>=20
> Attempting to write anything to stdout will cause the program to =
silently crash when executed with rubyw.exe on windows.
>=20
> The problem is trivial to duplicate:
>=20
> Source:
>=20
> f =3D File.new("test.txt", "w")
> f.write("failure")
> f.close
> puts "Hello, World"
> f =3D File.new("test.txt", "w")
> f.write("success")
> f.close
>=20
> ------------------------------
>=20
> Execution output:
>=20
> C:\>ruby test.rb
> Hello, World
>=20
> C:\>type test.txt
> success
>=20
>=20
> C:\>rubyw test.rb
>=20
> C:\>type test.txt
> failure
>=20
> -----END OUTPUT----------------
>=20
> This bug is not present in the 1.9.1 build of ruby for windows. A =
workaround is available, by providing a valid file descriptor for =
stdout, e.g. $stdout =3D File.new("stdout.txt", "w").

I might recommend a sane default being actually to set them to =
IO.new("NUL:", ..) on win32.

Defaulting to anything else either causes silent crashes due to ruby =
code, or potentially due to filesystem access issues.=