delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/01/30/14:04:55

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: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 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-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 AT gmail DOT 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 AT cygwin DOT com
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

- Raw text -


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