public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Edward Lam <triplequadsupport@gmail.com>
To: cygwin@cygwin.com
Subject: Pipes bug when spawning non-cygwin processes
Date: Thu, 30 Jan 2020 19:04:00 -0000	[thread overview]
Message-ID: <CAJZe6MDdZnE7BNZQWSHgaLo6sbx+9KVhG+wKfcruh_exPaZFLQ@mail.gmail.com> (raw)

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

             reply	other threads:[~2020-01-30 19:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 19:04 Edward Lam [this message]
2020-01-30 22:25 ` Takashi Yano
2020-01-31  6:25   ` Edward Lam
2020-02-18 19:24     ` Edward Lam
2020-02-18 19:43       ` Takashi Yano
2020-02-20 19:33         ` Edward Lam
2020-02-21  1:01           ` Takashi Yano
2020-02-21  1:08             ` Takashi Yano
2020-02-21  1:23               ` Takashi Yano
2020-02-24 14:46             ` Edward Lam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJZe6MDdZnE7BNZQWSHgaLo6sbx+9KVhG+wKfcruh_exPaZFLQ@mail.gmail.com \
    --to=triplequadsupport@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).