How to switch terminal to new child process of process launched with NSTask?

别来无恙 提交于 2019-12-07 09:53:55

I could finally do this by creating a pty device. To make a program behave like "Terminal", it must be executed in an interactive terminal, and that needs pseudo-terminal device.

Unfortunately, AFAIK, NSTask does not support any pty ability, so I had to get down to BSD layer.

Here's my current implementation: https://github.com/eonil/PseudoTeletypewriter.Swift

sudo is working well, and I believe ssh should also work.

Have a look at the source code of MFTask and PseudoTTY.app (which works on Mac OS X 10.6).

See: http://www.cocoadev.com/index.pl?NSTask

For a pty command line tool see here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!