pipe broken by WSL?

Thomas Wolff towo@towo.net
Sat May 4 06:49:00 GMT 2019


Hello Andrey,

Am 03.05.2019 um 20:52 schrieb Andrey Repin:
> Greetings, Eliot Moss!
>
>> On 5/2/2019 11:37 AM, Stephen Carrier wrote:
>>> On Wed, May 01, 2019 at 11:20:59AM +0200, Thomas Wolff wrote:
>>>> Calling WSL seems to break pipe processing:
>>>>
>>>> (echo 1; echo 2) |
>>>> while read line
>>>> do
>>>>     echo $line
>>>>     wsl uname
>>>> done
>>> I don't know about wsl, but could it be absorbing the standard input?
>>> What if "wsl uname" is replaced with "wsl uname < /dev/null" ?
>> You seem to be right; when I add < /dev/null as described, I get the expected output.
> Why not just
>
>      wsl uname <&-
>
> I wonder?
That gives me an error "Invalid handle", or, using `head` instead of 
`wsl`: head: failed to reopen 'stdin' with mode 'rb': Bad file descriptor.
By the way, a funny variant of the test case is

(echo 1; echo 2) |
while read line
do
    echo $line
    head -1
done
(Add an 'x' marker to the echo to watch the intricacies...)


--
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



More information about the Cygwin mailing list