This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bash pipe race condition


Windows 7 Service Pack 1
64-Bit Operating System

Cygwin
$ uname -r                                 
2.9.0(0.318/5/3)
$ uname -m                                 
x86_64                                                                

The basic issue is in a normal windows command shell if I do

$ .\input.exe | .\simple.exe                
line1
line2

If I use the same code from bash I get:

$ ./input.exe | ./simple.exe
line1
<—— Hangs indefinitely until you kill it or ctrl-c

Some how if input has a delay between its line output then things will get hung, if you remove the sleep from the input things work, add the sleep in it fails.


input.exe is generate from input.vb using: vbc input.vb

 input.vb file:
Module input
  Sub Main()
    Console.Out.WriteLine("line1")
    Threading.Thread.Sleep(2000)
    Console.Out.WriteLine("line2")
  End Sub
End Module

simple.exe is generated from simple.vb using: vbc simple.vb

simple.vb file:
Module simple
  Sub Main()
    Dim line As String
    line = Console.In.ReadLine()
    Do Until line Is Nothing
      Console.Out.WriteLine(line)
      line = Console.In.ReadLine()
    Loop
  End Sub
End Module

Microsoft (R) Visual Basic Compiler version 11.0.50938.18408

The above problem was found when attempting to use cygwin perl using IPC::Open2 to control stdin and stdout of a VB program. So this may not be a bash specific issue but some sort of generic pipe issue in cygwin.
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]