You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
os.forkpty is used in a few things (for me specifically, pexpect) to launch child processes. On posix this call is implemented in libc, and so in python it is a completely different call than os.fork. However the libc forkpty is just a wrapper around fork, and openpty and login_tty (see http://linux.die.net/man/3/openpty ), so the fundamental operations gevent needs will be the same as for fork.
When using gevent with pexpect (using the head version of master from github anyway), I have had success by creating this wrapper:
This has been tested with linux and osx - python 2.7.10, gevent 1.1b4, pexpect from github master. It works for my usage, there is no guarantee beyond that, but it's a starting point anyway.
Some more thoughts on this:
If gevent were to incorporate a proper os.forkpty wrapper, it would not be on windows, as this is pretty much posix specific functionality as I understand it.
there may need to be some wrapping to handle blocking nature of the pty fd. This however may not be needed, since it's a bare fd and people who implement things with ptyfork will have to use select and similar anyway, or know enough about the underlying system that they will intuit the need to do do special gevent things if doing a direct os.read (etc) on the fd.
The text was updated successfully, but these errors were encountered:
Thanks for the report. Even though we're late in the beta cycle, since this can be viewed as making an existing feature (waitpid) more complete and correct, and since the implementation is simple and piggybacks on existing tested code, it seems appropriate to me to go ahead and add it for 1.1b5. 0fdf78c Please let us know of any issues.
os.forkpty
is used in a few things (for me specifically,pexpect
) to launch child processes. On posix this call is implemented in libc, and so in python it is a completely different call thanos.fork
. However the libcforkpty
is just a wrapper aroundfork
, andopenpty
andlogin_tty
(see http://linux.die.net/man/3/openpty ), so the fundamental operationsgevent
needs will be the same as forfork
.When using
gevent
withpexpect
(using the head version of master from github anyway), I have had success by creating this wrapper:https://gist.github.com/sophacles/996f1b18a5ac4263c5b5
This has been tested with linux and osx - python 2.7.10, gevent 1.1b4, pexpect from github master. It works for my usage, there is no guarantee beyond that, but it's a starting point anyway.
Some more thoughts on this:
gevent
were to incorporate a properos.forkpty
wrapper, it would not be on windows, as this is pretty much posix specific functionality as I understand it.ptyfork
will have to useselect
and similar anyway, or know enough about the underlying system that they will intuit the need to do do specialgevent
things if doing a directos.read
(etc) on the fd.The text was updated successfully, but these errors were encountered: