Project

General

Profile

Backport #3602

stdout not set in rubyw.exe, causes silent failures

Added by Fitzsimmons (Justin Fitzsimmons) over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:31445]

Description

=begin
Attempting to write anything to stdout will cause the program to silently crash when executed with rubyw.exe on windows.

The problem is trivial to duplicate:

Source:

f = File.new("test.txt", "w")
f.write("failure")
f.close
puts "Hello, World"
f = File.new("test.txt", "w")
f.write("success")
f.close


Execution output:

C:>ruby test.rb
Hello, World

C:>type test.txt
success

C:>rubyw test.rb

C:>type test.txt
failure

-----END OUTPUT----------------

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 = File.new("stdout.txt", "w").
=end


Related issues

Related to Backport187 - Backport #4293: Errno::ENOMEM writing to STDOUT. Regression in 1.8.7-p330Closed01/19/2011Actions

History

#1

Updated by raggi (James Tucker) over 9 years ago

=begin

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

Author: Justin Fitzsimmons
Status: Open, Priority: Normal

Attempting to write anything to stdout will cause the program to silently crash when executed with rubyw.exe on windows.

The problem is trivial to duplicate:

Source:

f = File.new("test.txt", "w")
f.write("failure")
f.close
puts "Hello, World"
f = File.new("test.txt", "w")
f.write("success")
f.close


Execution output:

C:>ruby test.rb
Hello, World

C:>type test.txt
success

C:>rubyw test.rb

C:>type test.txt
failure

-----END OUTPUT----------------

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 = 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.

=end

#2

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

=begin
r11362.
=end

#3

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Category set to core
  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)

=begin

=end

#4

Updated by usa (Usaku NAKAMURA) about 9 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r29382.
Justin, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

#5

Updated by usa (Usaku NAKAMURA) about 9 years ago

  • Status changed from Closed to Assigned
  • Assignee changed from usa (Usaku NAKAMURA) to shyouhei (Shyouhei Urabe)
  • Category set to core
  • Priority changed from Normal to 3

=begin

=end

#6

Updated by shyouhei (Shyouhei Urabe) about 9 years ago

  • Status changed from Assigned to Closed

=begin
This issue was solved with changeset r29862.
Justin, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF