From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 68693 invoked by alias); 3 Oct 2017 01:06:22 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 68682 invoked by uid 89); 3 Oct 2017 01:06:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=hung X-HELO: red.jenika.com Received: from red.jenika.com (HELO red.jenika.com) (71.39.42.122) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Oct 2017 01:06:21 +0000 Received: from palladium.jenika.com (palladium.jenika.com [192.168.1.19]) (authenticated bits=0) by red.jenika.com (8.15.2/8.15.2) with ESMTPSA id v9316HU5007941 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 2 Oct 2017 18:06:18 -0700 From: Matthew McGIllis Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.0 \(3445.1.6\)) Subject: bash pipe race condition Message-Id: Date: Tue, 03 Oct 2017 01:06:00 -0000 To: cygwin@cygwin.com X-SW-Source: 2017-10/txt/msg00020.txt.bz2 Windows 7 Service Pack 1 64-Bit Operating System Cygwin $ uname -r=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 2.9.0(0.318/5/3) $ uname -m=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 x86_64=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The basic issue is in a normal windows command shell if I do $ .\input.exe | .\simple.exe=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 line1 line2 If I use the same code from bash I get: $ ./input.exe | ./simple.exe line1 <=E2=80=94=E2=80=94 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 =3D Console.In.ReadLine() Do Until line Is Nothing Console.Out.WriteLine(line) line =3D 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::O= pen2 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