3

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.

4

1 回答 1

3

如果“通过 Phobos 运行时支持伪终端”是指在底层操作系统支持的伪终端之上进行一些更高级别的抽象,那么我必须说我从未见过这样的事情。与 C++ 一样,D 可以直接调用 C 函数,所以如果您已经在 C 或 C++ 中做过类似的事情,我相信在 D 中编写类似期望的应用程序应该不难。

在 Linux 上,人们通常调用openpty(3),forkpty(3)login_tty(3)函数。我不知道其他系统。

于 2012-01-31T00:49:30.597 回答