2020-07-21 18:31:32 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from pexpect_helper import SpawnedProc
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
|
|
|
|
sp = SpawnedProc()
|
|
|
|
send, sendline, sleep, expect_prompt, expect_re, expect_str = (
|
|
|
|
sp.send,
|
|
|
|
sp.sendline,
|
|
|
|
sp.sleep,
|
|
|
|
sp.expect_prompt,
|
|
|
|
sp.expect_re,
|
|
|
|
sp.expect_str,
|
|
|
|
)
|
|
|
|
expect_prompt()
|
|
|
|
|
|
|
|
sendline("cat | cat")
|
|
|
|
sendline("set -l foo bar; echo $foo")
|
|
|
|
expect_str("set -l foo bar; echo $foo")
|
2020-08-08 11:20:50 +00:00
|
|
|
sleep(0.2)
|
2020-07-21 18:31:32 +00:00
|
|
|
|
|
|
|
send("\x1A")
|
2020-08-08 11:20:50 +00:00
|
|
|
sleep(0.2)
|
2020-07-21 18:31:32 +00:00
|
|
|
expect_prompt()
|
|
|
|
sendline("set -l foo bar; echo $foo")
|
|
|
|
expect_str("bar")
|
|
|
|
|
|
|
|
expect_prompt()
|
|
|
|
sendline("fg")
|
|
|
|
expect_str("Send job 1, 'cat | cat' to foreground")
|
|
|
|
sendline("set -l foo bar; echo $foo")
|
|
|
|
expect_str("set -l foo bar; echo $foo")
|
|
|
|
send("\x04")
|
|
|
|
|
|
|
|
expect_prompt()
|
|
|
|
sendline("set -l foo bar; echo $foo")
|
|
|
|
expect_str("bar")
|