fork/fish-shell

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

Łukasz WieczorekReformat with black.82750bbae

master
944 B42 linesraw
1#!/usr/bin/env python3
2# Verify that stdin is properly set to blocking even if a job tweaks it.
3from pexpect_helper import SpawnedProc
4import os
5
6sp = SpawnedProc()
7send, sendline, expect_prompt, expect_str, sleep = (
8    sp.send,
9    sp.sendline,
10    sp.expect_prompt,
11    sp.expect_str,
12    sp.sleep,
13)
14
15if not os.environ.get("fish_test_helper", ""):
16    import sys
17
18    sys.exit(127)
19
20# Launch fish_test_helper.
21expect_prompt()
22exe_path = os.environ.get("fish_test_helper")
23sendline(exe_path + " stdin_make_nonblocking")
24
25expect_str("stdin was blocking")
26sleep(0.1)
27
28send("\x1a")  # ctrl-Z
29expect_prompt("has stopped")
30
31# We don't "restore" non-blocking state when continuing a stopped job.
32sleep(0.1)
33sendline("fg")
34expect_str("stdin was blocking")
35
36# Kill the job and do it again.
37send("\x03")  # ctrl-c
38expect_prompt()
39sendline(exe_path + " stdin_make_nonblocking")
40expect_str("stdin was blocking")
41send("\x03")  # ctrl-c
42expect_prompt()