X-Recipient: archive-cygwin@delorie.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:mime-version:from:date:message-id:subject:to
	:content-type; q=dns; s=default; b=JGn+FdyxahsdgiIFL4ONpNkQ/MYXD
	qo4k66WYD84vJYQMWbI1nUTP+jiAKyWfo05iR5hNadW/o83xKtIs5m7spU0M5bsd
	7C/pKl8APaoy7uh7DHmoWM6YbX7ZF0b92R+W/NiFX66rB62MGlkxDbKjs7m3Ug1h
	aKhR9dkKSnax+o=
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:mime-version:from:date:message-id:subject:to
	:content-type; s=default; bh=4WrKAwBzUgkTfKc+BOY45C++qV0=; b=SPY
	yybFj8xMUz+2JDNKt2RWKe+GMk8nP8NHlAM0koq8ohiO9V8gLrL4ODUfTIlPwmrg
	8froB3Pm1jqTL6pSl7188EFXeFrP7Bmg11MWynmLp/si1ruZUDzpDc7TXOk4T5OE
	W4xKLiMhAyxopAepNNcgX9iobgFr4nSnmvuc6hP0=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=ppid, cygwins, cygwin's, H*c:alternative
X-HELO: mail-ed1-f50.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=20161025;        h=mime-version:from:date:message-id:subject:to;        bh=upp/73WEd3kShMwEQytLQDLK3GJu85U3e+vR5lGMZH8=;        b=nWJwxf3XflnJtJbhafDGKkYdoV1fGzE5/Qj0PejUAmjKsl53Y3S8SYZrGF7ovJPYH+         1/Eh2TZ4RJh6VZ3OebOJATYaLPIMjDAssSHwhhkQBf+npaj3wNRYqrbpQeEeATQqX7GR         dS0PW0wcXeeTm/zfnT7Dkq0ZEwlFQEBMhYT/GBWsmncxAqhrYa3hRwRj8oZ5V+i3WOeI         /dH+H+XIPnaetlYqh7EYxK26XEF7EJJkSeZMomzLlvp0wh8u8WF/EULz2eUdvJxXGH5C         GCufipR1sUmsz3EQ2iuNws5zZ007/zWHgVJcoIoWvk+hUrzdTTkkWqkaauiCKWjV05Kc         i4hA==
MIME-Version: 1.0
From: Edward Lam <triplequadsupport@gmail.com>
Date: Thu, 30 Jan 2020 14:03:50 -0500
Message-ID: <CAJZe6MDdZnE7BNZQWSHgaLo6sbx+9KVhG+wKfcruh_exPaZFLQ@mail.gmail.com>
Subject: Pipes bug when spawning non-cygwin processes
To: cygwin@cygwin.com
Content-Type: text/plain; charset="UTF-8"
X-IsSubscribed: yes

Hi Folks,

I'm getting a problem where cygwin parent processes spawning non-cygwin
child processes no longer detect when stdin has been closed. Please see the
sample python code at the end where I've isolated the problem. I've got
cygwin's python2 running spawn_bar.py that popen's a native non-cygwin
python2 running bar.py. The steps to reproduce are to run this command
using the two files detailed at the end of this email:

$ python2 spawn_bar.py

On Windows 10, this command quits right away as expected when using cygwin
3.0.7 but hangs when using cygwin 3.1.2 (version number as reported from
running `cygcheck -c cygwin`).

Looking through the release logs, nothing sticks out except for the change
in 3.1.0 that mentions PTY changes. However, when I originally ran into
this, it wasn't even being done through a terminal but some background
script.

Any ideas?

Thanks,
-Edward

# spawn_bar.py
import os
import subprocess
import sys
python = "python2" # this works
python = "/path/to/native/python2" # this hangs
p = subprocess.Popen([python, 'bar.py'], stdin=subprocess.PIPE)
p.stdin.close()
pid, status = os.waitpid(p.pid, 0)

# bar.py
import sys
for line in sys.stdin:
    print 'got: ' + line

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

