This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sbt
Recipients David.Edelsohn, db3l, flox, gvanrossum, larry, ncoghlan, neologix, pitrou, python-dev, sbt, skrah, tim.peters, vstinner
Date 2013-10-21.16:19:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382372345.35.0.38055874747.issue19293@psf.upfronthosting.co.za>
In-reply-to
Content
The following uses socketpair() instead of pipe() for stdin, and works for me on Linux:

diff -r 7d94e4a68b91 asyncio/unix_events.py
--- a/asyncio/unix_events.py    Sun Oct 20 20:25:04 2013 -0700
+++ b/asyncio/unix_events.py    Mon Oct 21 17:15:19 2013 +0100
@@ -272,8 +272,6 @@
         self._loop = loop
         self._pipe = pipe
         self._fileno = pipe.fileno()
-        if not stat.S_ISFIFO(os.fstat(self._fileno).st_mode):
-            raise ValueError("Pipe transport is for pipes only.")
         _set_nonblocking(self._fileno)
         self._protocol = protocol
         self._buffer = []
@@ -442,9 +440,16 @@
         self._finished = False
         self._returncode = None

+        if stdin == subprocess.PIPE:
+            stdin_w, stdin_r = socket.socketpair()
+        else:
+            stdin_w = stdin_r = None
         self._proc = subprocess.Popen(
-            args, shell=shell, stdin=stdin, stdout=stdout, stderr=stderr,
+            args, shell=shell, stdin=stdin_r, stdout=stdout, stderr=stderr,
             universal_newlines=False, bufsize=bufsize, **kwargs)
+        if stdin_r is not None:
+            stdin_r.close()
+            self._proc.stdin = open(stdin_w.detach(), 'rb', buffering=bufsize)
         self._extra['subprocess'] = self._proc

     def close(self):
History
Date User Action Args
2013-10-21 16:19:05sbtsetrecipients: + sbt, gvanrossum, tim.peters, db3l, ncoghlan, pitrou, vstinner, larry, skrah, flox, neologix, python-dev, David.Edelsohn
2013-10-21 16:19:05sbtsetmessageid: <1382372345.35.0.38055874747.issue19293@psf.upfronthosting.co.za>
2013-10-21 16:19:05sbtlinkissue19293 messages
2013-10-21 16:19:05sbtcreate