D 和伪终端
D 是否通过 Phobos 运行时库内置了对伪终端的支持?...我假设没有,因为 pty 是高度特定于平台的。还有其他第三方替代品吗?最终,我想为 D 实现一个类似 Expect 的库(如果它还不存在)。
Does D have built in support for pseudo-terminals via the Phobos runtime libraries ?...I'm assuming there isn't since ptys are highly platform specific. Are there other third party alternatives ? Ultimately, I'd like to implement an Expect-like library for D if it doesn't already exist.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果“通过 Phobos 运行时支持伪终端”意味着底层操作系统支持的伪终端之上的一些更高级别的抽象,那么我必须说我从未见过这样的事情。与 C++ 一样,D 可以直接调用 C 函数,因此我相信,如果您已经在 C 或 C++ 中做过类似的事情,那么在 D 中编写类似 Expect 的应用程序应该不难。
在 Linux 上,人们通常调用
openpty(3)
、forkpty(3)
或login_tty(3)
函数。我不知道其他系统。If by "support for pseudo-terminals via the Phobos runtime" you mean some higher level abstraction on top of the pseudo-terminals supported by the underlying operating-system, then I must say I have never seen such a thing. Like C++, D can directly call C functions, so I believe writing an expect-like application in D should not be difficult if you already did something similar in C or C++.
On Linux people typically call
openpty(3)
,forkpty(3)
orlogin_tty(3)
functions. I do not know about other systems.