fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
2508cc9de
master
1#!/usr/bin/env python3 2import os 3from pexpect_helper import SpawnedProc 4import signal 5 6sp = SpawnedProc () 7send ,sendline ,sleep ,expect_str ,expect_prompt = ( 8sp .send , 9sp .sendline , 10sp .sleep , 11sp .expect_str , 12sp .expect_prompt , 13) 14expect_prompt () 15 16timeout = 0.15 17 18if "CI" in os .environ : 19# This doesn't work under TSan, because TSan prevents select() being 20# interrupted by a signal. 21import sys 22 23"SKIPPING cancel_event.py" ) 24sys .exit (127 ) 25 26# Verify that cancel-commandline does what we expect - see #7384. 27send ("not executed" ) 28sleep (timeout ) 29os .kill (sp .spawn .pid ,signal .SIGINT ) 30sendline ("echo marker" ) 31sp .expect_str ("marker" ) 32expect_prompt () 33 34sendline ("function cancelhandler --on-event fish_cancel ; echo yay cancelled ; end" ) 35expect_prompt () 36send ("still not executed" ) 37sleep (timeout ) 38os .kill (sp .spawn .pid ,signal .SIGINT ) 39expect_str ("yay cancelled" ) 40sendline ("echo marker" ) 41sp .expect_str ("marker" ) 42expect_prompt ()