fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
64e3b419b
master
1#!/usr/bin/env python3 2from pexpect_helper import SpawnedProc 3import platform 4 5import sys 6 7 8# Set a 0 terminal size 9sp = SpawnedProc (args = ["-d" ,"term-support" ],dimensions = (0 ,0 )) 10send ,sendline ,sleep ,expect_prompt ,expect_re ,expect_str = ( 11sp .send , 12sp .sendline , 13sp .sleep , 14sp .expect_prompt , 15sp .expect_re , 16sp .expect_str , 17) 18 19expect_prompt () 20# Now confirm it defaulted to 80x24 21sendline ("echo $COLUMNS $LINES" ) 22expect_str ("80 24" ) 23expect_str ("term-support: Terminal has 0 columns, falling back to default width" ) 24expect_str ("term-support: Terminal has 0 rows, falling back to default height" ) 25expect_prompt () 26 27# See if $LINES/$COLUMNS change in response to sigwinch, also in a --on-signal function 28sendline ("function on-winch --on-signal winch; echo $LINES $COLUMNS; end" ) 29expect_prompt () 30sleep (4 ) 31sp .spawn .setwinsize (40 ,50 ) 32expect_str ("40 50" ) 33sendline ("echo $LINES $COLUMNS" ) 34expect_prompt ("40 50" ) 35 36sp .spawn .setwinsize (20 ,70 ) 37expect_str ("20 70" ) 38sendline ("echo $LINES $COLUMNS" ) 39expect_prompt ("20 70" ) 40 41sendline ("stty -a" ) 42expect_prompt () 43# Confirm flow control in the shell is disabled - we should ignore the ctrl-s in there. 44sendline ("echo hello\x13hello" ) 45expect_prompt ("hellohello" ) 46 47# Confirm it is off for external commands 48sendline ("stty -a | string match -q '*-ixon -ixoff*'; echo $status" ) 49expect_prompt ("0" ) 50 51# Turn flow control on 52sendline ("stty ixon ixoff" ) 53expect_prompt () 54sendline ("stty -a | string match -q '*ixon ixoff*'; echo $status" ) 55expect_prompt ("0" ) 56 57sys .exit (0 ) 58# HACK: This fails on FreeBSD, macOS and NetBSD for some reason, maybe 59# a pexpect issue? 60# So disable it everywhere but linux for now. 61if platform .system ()in ["Linux" ]: 62# Flow control does not work in CSI u mode, but it works while we are running an external process. 63sendline ("sh -c 'for i in $(seq 10); do echo $i; sleep 1; done" ) 64sendline ("hello\x13hello" ) 65# This should not match because we should not get any output. 66# Unfortunately we have to wait for the timeout to expire - set it to a second. 67expect_str ("hellohello" ,timeout = 1 ,shouldfail = True ) 68send ("\x11" )# ctrl-q to resume flow 69expect_prompt ("hellohello" )