mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 19:37:24 +08:00
Fix fg tests on macOS
Apparently on macOS SIGTSTP (from control-Z) causes `read()` to return EINTR. This means `cat | cat` will exit as soon as it's backgrounded and brought back. So instead we use `sleep`, which won't read(), and therefore is impervious to these puny attacks. See discussion in #7447.
This commit is contained in:
parent
21041e3cc7
commit
4c9d01cab0
@ -15,11 +15,12 @@ send, sendline, sleep, expect_prompt, expect_re, expect_str = (
|
||||
)
|
||||
expect_prompt()
|
||||
|
||||
sendline("cat | cat")
|
||||
sendline("sleep 500")
|
||||
sendline("set -l foo bar; echo $foo")
|
||||
expect_str("set -l foo bar; echo $foo")
|
||||
expect_str("")
|
||||
sleep(0.2)
|
||||
|
||||
# ctrl-z - send job to background
|
||||
send("\x1A")
|
||||
sleep(0.2)
|
||||
expect_prompt()
|
||||
@ -28,10 +29,12 @@ expect_str("bar")
|
||||
|
||||
expect_prompt()
|
||||
sendline("fg")
|
||||
expect_str("Send job 1, 'cat | cat' to foreground")
|
||||
expect_str("Send job 1, 'sleep 500' to foreground")
|
||||
sleep(0.2)
|
||||
sendline("set -l foo bar; echo $foo")
|
||||
expect_str("set -l foo bar; echo $foo")
|
||||
send("\x04")
|
||||
expect_str("")
|
||||
# ctrl-c - cancel
|
||||
send("\x03")
|
||||
|
||||
expect_prompt()
|
||||
sendline("set -l foo bar; echo $foo")
|
||||
|
Loading…
x
Reference in New Issue
Block a user