From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 107687 invoked by alias); 3 Oct 2017 12:56:21 -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 107675 invoked by uid 89); 3 Oct 2017 12:56:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*R:D*cygwin.com, Hx-languages-length:1501, PTY, pty X-HELO: mail-it0-f42.google.com Received: from mail-it0-f42.google.com (HELO mail-it0-f42.google.com) (209.85.214.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Oct 2017 12:56:19 +0000 Received: by mail-it0-f42.google.com with SMTP id e134so11250387ite.3 for ; Tue, 03 Oct 2017 05:56:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:reply-to:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=T3PrgfKZ/j3/8LGuw2wAKaAcSnDQg0WLv/wjgQRTykk=; b=TJBPnh4tod/ia1UHE9eS6D1xcOfw4NHWtm0fedsAHhu6HOC/fgXma1BiBhu7C58z1p +uyRPom7pKbWPR1y4oyOeC7uwqCX51phx2elgkkgqt5masCNculQGCccnxp8q8l0cwwA YyBweB/Y8QcbEUNQU7rJ8ax+RwnwFVI/8tIkWM35onYG77R3vtPbku3eW1gAGz8GJxNK eYhpdzvaF182yLIa3Lb2hMfDyqpwvXk0BcqdYLtj7R31SLtgPhYdmw44BT9M49/zmVHg eUfN2QSLugi5onxPFXtkrF5LiLsxrPvm6LbjQFwT7ivMJwodDPzJdgTCgC/ppSjWu3q3 hUFg== X-Gm-Message-State: AHPjjUjlvMMacpLVKb0lT09cTFC/8b5r0i3KmROYbRZpMPIdOAcSjlbI YIy0Ee0jeUx0PiDx0hf2OC+Qbw== X-Google-Smtp-Source: AOwi7QBbj4N+yXPz3K/aSBE+ogf9AfCOT9s9cschFk+wHTmTjkeSwGHpPTVc4Sabqee1oPK4fPJYWA== X-Received: by 10.36.230.129 with SMTP id e123mr24405526ith.108.1507035377169; Tue, 03 Oct 2017 05:56:17 -0700 (PDT) Received: from [192.168.0.6] (d4-50-42-50.try.wideopenwest.com. [50.4.50.42]) by smtp.gmail.com with ESMTPSA id o71sm5794511itb.15.2017.10.03.05.56.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 05:56:16 -0700 (PDT) Subject: Re: bash pipe race condition To: cygwin@cygwin.com References: From: cyg Simple Reply-To: cygwin@cygwin.com Message-ID: <33e9d184-03b1-5fa5-4c1a-0cca19571a3a@gmail.com> Date: Tue, 03 Oct 2017 12:56:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00027.txt.bz2 On 10/2/2017 9:06 PM, Matthew McGIllis wrote: > > 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. It is a known issue of the PTY emulation between a Cygwin runtime and a Windows runtime enabled app. It just cannot be fixed. You're even lucky that it works in the Windows command shell. Either convert simple.vb to simple.c and use Cygwin's gcc to build it or create a Windows runtime version of input.exe. -- cyg Simple -- 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