如何解决从 libexpect 调用本机函数
我想从 libexpect
调用本机函数,特别是在有输入时。我可以使用 pexpect
这样做。
import pexpect
def f(input):
# here I do whatever I want depending upon the input
return input;
p=pexpect.spawn('bash')
p.interact(chr(29),input_filter=f)
是否可以使用 C
在 libexpect
中执行此类操作? expect
的联机帮助页指出:
interact [string1 body1] ... [stringn [bodyn]]
gives control of the current process to the user,so that key‐
strokes are sent to the current process,and the stdout and
stderr of the current process are returned.
String-body pairs may be specified as arguments,in which case
the body is executed when the corresponding string is entered.
(By default,the string is not sent to the current process.)
但是,当使用 C
时,我将如何从主体调用 libexpect
函数?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。