2020-08-13 12:35:37 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
from pexpect_helper import SpawnedProc
|
|
|
|
|
|
|
|
sp = SpawnedProc()
|
|
|
|
sendline, sleep, expect_prompt, expect_str = (
|
|
|
|
sp.sendline,
|
|
|
|
sp.sleep,
|
|
|
|
sp.expect_prompt,
|
|
|
|
sp.expect_str,
|
|
|
|
)
|
|
|
|
|
|
|
|
# Ensure that if child processes SIGINT, we exit our loops.
|
|
|
|
# This is an interactive test because the parser is expected to
|
|
|
|
# recover from SIGINT in interactive mode.
|
|
|
|
# Test for #7259.
|
|
|
|
|
|
|
|
expect_prompt()
|
|
|
|
sendline("while true; sh -c 'echo Here we go; sleep .25; kill -s INT $$'; end")
|
|
|
|
sleep(0.30)
|
|
|
|
expect_str("Here we go")
|
|
|
|
expect_prompt()
|
2022-03-21 05:32:18 +08:00
|
|
|
sendline("echo $status")
|
|
|
|
expect_str("130")
|
2023-12-22 19:27:01 +08:00
|
|
|
expect_prompt()
|
2020-08-13 12:35:37 +08:00
|
|
|
|
|
|
|
sendline("echo it worked")
|
|
|
|
expect_str("it worked")
|
|
|
|
expect_prompt()
|