public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Pipes bug when spawning non-cygwin processes
@ 2020-01-30 19:04 Edward Lam
  2020-01-30 22:25 ` Takashi Yano
  0 siblings, 1 reply; 10+ messages in thread
From: Edward Lam @ 2020-01-30 19:04 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-02-24 14:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-30 19:04 Pipes bug when spawning non-cygwin processes Edward Lam
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

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