From: Trey Campbell Date: 2003-12-19T07:11:13+09:00 Subject: Re: question about I/O and pipes Robert Klemme wrote: >"Jean-Baptiste" schrieb im Newsbeitrag >news:3fe187d2$0$7163$626a54ce@news.free.fr... > > >>There is a (very) little programm (count.rb) which count lines: >> >>cnt = 0 >>$stdin.each_line {|line| cnt = cnt + 1 } >>print cnt,"\n" >> >> >>Now I want to use it whith pipes like this: >>dir | count >>but i got this error >>C:\ruby>dir | count >>C:/ruby/count.rb:3:in `each_line': Bad file descriptor (Errno::EBADF) >> from Z:/ruby/count.rb:3 >> >>What is the problem? >>(NB: I an working on Windows2000.) >> >> > >I guess that's the problem. AFAIK there are some troubles with Windows >pipes... > > robert > > > > > I get the same error for: c:> dir | count but it appears to work as you'd expect for: c:> dir | ruby count.rb Does that help? Trey