Project

General

Profile

Actions

Bug #3215

closed

Windows: IO.popen returns "handle is invalid"

Added by docwhat (Christian Höltje) over 14 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
ruby -v:
ruby 1.9.1p376 (2009-12-07) [x64-mswin64_80]
[ruby-core:29845]

Description

=begin
This is with a VS8 compiled version of ruby.

Given this simple program (foo.rb):
----------->8---------cut--------8<------------
puts "" * 20
p IO.popen('echo HI') {|f| f.readlines}
puts "
" * 20
----------->8---------cut--------8<------------

I get this:
----------->8---------cut--------8<------------
E:\test>bin\ruby.exe foo.rb


The handle is invalid.
[]


E:\test>
----------->8---------cut--------8<------------

Interestingly, if I redirect to a file, it works:
----------->8---------cut--------8<------------
E:\test>bin\ruby.exe foo.rb > q

E:\test>type q


["HI\n"]


E:\test>
----------->8---------cut--------8<------------

I'm not sure what is going on, but I know that the python group had similar problems in python < 2.6.... maybe we can crib their solution?

Ciao!

Python URLs:
http://bytes.com/topic/python/answers/634409-subprocess-handle-invalid-error
http://bugs.python.org/issue1124861 -- The patch is interesting.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0