error with anon pipe in Win7

mkosma
2009-05-30
2013-06-12
  • mkosma
    mkosma
    2009-05-30

    I have a small ruby script n.rb that captures STDIN into a temp file (then does stuff with it).  Basically, the only line that matters is along the lines of

    x=STDIN.readlines

    and it's executed either by

    cat foo.txt | n.rb

    or

    n.rb < foo.txt

    This little script works fine in Vista with cmd.exe or console2.

    In Win7-64, script works fine in cmd.exe, but generates this error in console 2.0b144:

    C:\Program Files (x86)\Console2>dir |n.rb
    C:/bin/n.rb:15:in `readlines': Bad file descriptor (Errno::EBADF)
            from C:/bin/n.rb:15

    C:\Program Files (x86)\Console2>

    does console somehow mess with pipe behavior?

     
    • Srivatsan
      Srivatsan
      2009-06-04

      I found an error something similar to this. But this is in windows xp. When in a command if i use more than one redirects or >> or if there is a pipe and a redirect, console screen stops updating the output or keyboard inputs. But everything seems fine in the command window.