www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/10/03/08:56:32

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=U7ZLU3KZO9DcdO3M
P8PCzI+hGGfOBjmsn//yCD5eeQ49y+OUCHUWGPsDyQyb5RqbG1QvJoHUwx1E+ro+
hqQHvGX1cOJP6FI5Jy7sGOvGuMneSHLN8JLVjaC+scQYHXih2SKoG+e6sTz4RsRd
h/1xPNOvSvKeeFz0h7Bhx69Vzbc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:reply-to:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=bY7Jc6x0hK0LzTJ5EYPaAV
P+fQ4=; b=YRFgcc/1fBUiGYUoGSpdPwIp1jx5AZYfeWG3yGoUQPFSayx0ain+V9
YQr2lP9JqLhwmPDUaIEf2qW2i50pfLuow+mPa/BidLb8bgTFr2zi7pOi8pxbvn/h
mAEjRdZvVIf68fTaqSX+aTqjcGqaEFcW9AYB/JBIOtxssqZi73xq8=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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
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)
Subject: Re: bash pipe race condition
To: cygwin AT cygwin DOT com
References: <B05F4669-BE32-4C5C-B366-555CE37A6761 AT mcgillis DOT org>
From: cyg Simple <cygsimple AT gmail DOT com>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <33e9d184-03b1-5fa5-4c1a-0cca19571a3a@gmail.com>
Date: Tue, 3 Oct 2017 08:56:17 -0400
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: <B05F4669-BE32-4C5C-B366-555CE37A6761@mcgillis.org>
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019