-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work around missing /proc/ entries on macOS #6
Comments
There are projects out there that completely reparent processes under a different terminal. However, they also have trouble with macOS, see nelhage/reptyr#99 |
The pipe approach almost works with a little hackery in forwarding termios requests back and forth. However, there is a rather fundamental problem in signal handling when running something like IPython. While a command is running in IPython, when the client receives a SIGINT (C-c), we would like to just forward it to the forked process. However, morallly, we would have to signal the tcgetpgrp so the keyboard interrupt is raised in the foreground python process and not in IPython itself. However, we cannot tcsetpgrp in the forked process without allocating a pty first. So essentially, to make things happen we have to implement our own little terminal multiplexer here. Instead of reinventing the wheel here, we should probably use something like https://github.com/prompt-toolkit/ptterm to get the details right. Then again, we probably don't want to pull in a dependency on prompt toolkit so maybe we should just take the tricks from https://github.com/prompt-toolkit/ptterm/blob/master/ptterm/backends/posix.py. |
On macOS we cannot get the file descriptors of another process on the filesystem unfortunately so redirecting stdio does not work.
In principle we could just create a pipe for stdin, stdout, stderr and then just cat everything through these pipes. However, ipython queries the features of stdout (or does it just read termcap and such?) so this won't work unless we can trick ipython and friends into detecting the features of the other end of the pipe.
If you're interested in making this work, I am happy to assist. However, since I don't use macOS myself, I am realistically not going to put the effort in to make this happen.
The text was updated successfully, but these errors were encountered: