how to hook into system level expect with Java?

前端 未结 3 483
无人共我
无人共我 2021-01-26 00:20

See also a better question, more specific, on this topic.

I\'ve just discovered expect, a tcl based scripting language for automating, among other things, telnet connect

3条回答
  •  走了就别回头了
    2021-01-26 01:06

    What mechanisms are available to either hook into expect with Java, or into Java with expect?

    None really. The problem is that expect does some really complicated low-level things to manage pseudo-terminals and that uses OS interfaces that the JRE doesn't expose. (It's even more tricky if you're on Windows, where it uses the system debug API.) You'd have to go to doing nasty stuff with native code.

    The easy route is to run expect as a subprocess via ProcessBuilder.

提交回复
热议问题