New submission from Chris Torek:

The pty.spawn() code assumes that when the process on the slave side of the pty 
quits, the master side starts raising OSError when read-from or written-to.

That used to be true in FBSD, but then someone fixed (?) it, and now the master 
side simply returns EOF when read-from.  Furthermore, writes to the master 
simply disappear into the aether (this may be an OS bug, but even if the writes 
raised OSError, you would still have to type something in on stdin to get it 
copied over to get the error raised to get out of the loop).

The fix here makes an assumption that is true when using the built-in read 
calls: EOF on the master indicates that the slave is no longer reachable in any 
way and the whole thing should finish up immediately.  It might perhaps need a 
bit of documentation should someone want to substitute in their own read 
function (see enhancement request in issue22865).

I also fixed (sort of) issue17824, but only barely minimally, and put in a 
comment that it should really use the same mechanism as subprocess (but I think 
that should be a separate patch).

----------
files: pty.patch
keywords: patch
messages: 259088
nosy: Chris Torek
priority: normal
severity: normal
status: open
title: pty.spawn hangs on FreeBSD 9.3, 10.x
Added file: http://bugs.python.org/file41738/pty.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26228>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to