* bash pipe race condition
@ 2017-10-03 1:06 Matthew McGIllis
2017-10-03 12:56 ` cyg Simple
0 siblings, 1 reply; 4+ messages in thread
From: Matthew McGIllis @ 2017-10-03 1:06 UTC (permalink / raw)
To: cygwin
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bash pipe race condition
2017-10-03 1:06 bash pipe race condition Matthew McGIllis
@ 2017-10-03 12:56 ` cyg Simple
2017-10-04 3:39 ` Kaz Kylheku
0 siblings, 1 reply; 4+ messages in thread
From: cyg Simple @ 2017-10-03 12:56 UTC (permalink / raw)
To: cygwin
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bash pipe race condition
2017-10-03 12:56 ` cyg Simple
@ 2017-10-04 3:39 ` Kaz Kylheku
2017-10-04 14:42 ` cyg Simple
0 siblings, 1 reply; 4+ messages in thread
From: Kaz Kylheku @ 2017-10-04 3:39 UTC (permalink / raw)
To: cygwin
On 03.10.2017 05:56, cyg Simple wrote:
> 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
[ ... ]
>
> 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.
Lucky? Are VB console apps known to have unreliable piping when
used from the Windows command processor?
> Either convert
> simple.vb to simple.c and use Cygwin's gcc to build it or create a
> Windows runtime version of input.exe.
Isn't that what "input.exe is generate[d] from input.vb using: vbc
input.vb"
is referring to?
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bash pipe race condition
2017-10-04 3:39 ` Kaz Kylheku
@ 2017-10-04 14:42 ` cyg Simple
0 siblings, 0 replies; 4+ messages in thread
From: cyg Simple @ 2017-10-04 14:42 UTC (permalink / raw)
To: cygwin
On 10/3/2017 11:39 PM, Kaz Kylheku wrote:
> On 03.10.2017 05:56, cyg Simple wrote:
>> 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
> [ ... ]
>>
>> 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.
>
> Lucky? Are VB console apps known to have unreliable piping when
> used from the Windows command processor?
>
>> Either convert
>> simple.vb to simple.c and use Cygwin's gcc to build it or create a
>> Windows runtime version of input.exe.
>
> Isn't that what "input.exe is generate[d] from input.vb using: vbc
> input.vb"
> is referring to?
Oh, yes, sorry I missed that. Still an issue with PTY and cannot be
fixed regardless without creating a C program of both. Straight console
on the stdin and stdout channels might work with the C runtime with MS
runtime but should be Cygwin runtime when using Cygwin.
--
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-04 14:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 1:06 bash pipe race condition Matthew McGIllis
2017-10-03 12:56 ` cyg Simple
2017-10-04 3:39 ` Kaz Kylheku
2017-10-04 14:42 ` cyg Simple
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).