fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Deepak kudiPropagate SIGINT from function processesfd52c5dcd

master
940 B39 linesraw
1#!/usr/bin/env python3
2from pexpect_helper import SpawnedProc
3
4sp = SpawnedProc()
5send, sendline, sleep, expect_prompt, expect_str = (
6    sp.send,
7    sp.sendline,
8    sp.sleep,
9    sp.expect_prompt,
10    sp.expect_str,
11)
12
13# Ensure that if child processes SIGINT, we exit our loops.
14# This is an interactive test because the parser is expected to
15# recover from SIGINT in interactive mode.
16# Test for #7259.
17
18expect_prompt()
19sendline("while true; sh -c 'echo Here we go; sleep .25; kill -s INT $$'; end")
20sleep(0.30)
21expect_str("Here we go")
22expect_prompt()
23sendline("echo $status")
24expect_str("130")
25expect_prompt()
26
27sendline("echo it worked")
28expect_str("it worked")
29expect_prompt()
30
31sendline("function interrupt_test; sleep 1; echo hello; end")
32expect_prompt()
33sendline("while true; interrupt_test; end")
34sleep(0.30)
35send("\x03")  # ctrl-c
36expect_prompt()
37sendline("echo loop interrupted")
38expect_str("loop interrupted")
39expect_prompt()