// retoor <retoor@molodetz.nl>
|
|
|
|
import "pexpect" for Spawn, Pexpect
|
|
|
|
var child = Spawn.new("echo hello")
|
|
var result = child.expect(["hello"])
|
|
System.print(result) // expect: 0
|
|
|
|
child = Spawn.new("cat")
|
|
child.sendline("test input")
|
|
var idx = child.expect(["test input"])
|
|
System.print(idx) // expect: 0
|
|
child.sendeof()
|
|
child.close()
|