Project

General

Profile

Bug #2549

Redirected stdout don't work on child process on Windows

Added by phasis68 (Heesob Park) over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
ruby -v:
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
[ruby-core:27376]

Description

=begin
A file created in Ruby and redirected to stdout don't work properly on child process in 1.9.x.

c:\work>type test.rb
STDOUT.reopen(File.open('out.txt', 'w+'))
system('ruby -v')
File.open('out.txt','a+'){|f|f.puts('EOF')}

In 1.8.6
c:\work>type out.txt
ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]
EOF

In 1.9.1p243 and 1.9.2dev
c:\work>type out.txt
EOF

I noticed the root cause is FILE_FLAG_OVERLAPPED handling of
ruby 1.9.x. I guess it is related with the select and native thread supporting
on Windows. But the child process cannot handle the overlapped
I/O on most cases.

In short, the inheritable file handle must not opened with the
FILE_FLAG_OVERLAPPED flag.

Regards,
Park Heesob
=end


Related issues

Is duplicate of Backport191 - Bug #2510: xsystem fails in 1.9/mingwClosed12/22/2009Actions

Associated revisions

Revision 27449
Added by usa (Usaku NAKAMURA) over 9 years ago

  • win32/win32.c (rb_w32_wopen): shouldn't use FILE_FLAG_OVERLAPPED with normal file. #1807, #2510, #2549

Revision 27449
Added by usa (Usaku NAKAMURA) over 9 years ago

  • win32/win32.c (rb_w32_wopen): shouldn't use FILE_FLAG_OVERLAPPED with normal file. #1807, #2510, #2549

Revision 27449
Added by usa (Usaku NAKAMURA) over 9 years ago

  • win32/win32.c (rb_w32_wopen): shouldn't use FILE_FLAG_OVERLAPPED with normal file. #1807, #2510, #2549

Revision 27449
Added by usa (Usaku NAKAMURA) over 9 years ago

  • win32/win32.c (rb_w32_wopen): shouldn't use FILE_FLAG_OVERLAPPED with normal file. #1807, #2510, #2549

Revision 27449
Added by usa (Usaku NAKAMURA) over 9 years ago

  • win32/win32.c (rb_w32_wopen): shouldn't use FILE_FLAG_OVERLAPPED with normal file. #1807, #2510, #2549

Revision 27449
Added by usa (Usaku NAKAMURA) over 9 years ago

  • win32/win32.c (rb_w32_wopen): shouldn't use FILE_FLAG_OVERLAPPED with normal file. #1807, #2510, #2549

History

#1

Updated by usa (Usaku NAKAMURA) over 9 years ago

  • Status changed from Open to Closed

=begin
fixed at r27449
=end

Also available in: Atom PDF