Help fg.py test pass more on macOS

This commit is contained in:
ridiculousfish 2024-05-05 17:44:34 -07:00
parent 7b524f6995
commit f6f1d93df5

View File

@ -2,6 +2,7 @@
from pexpect_helper import SpawnedProc from pexpect_helper import SpawnedProc
import os import os
import platform import platform
import signal
import subprocess import subprocess
import sys import sys
import time import time
@ -33,22 +34,23 @@ send("\x1A")
sleep(1.2) sleep(1.2)
expect_prompt() expect_prompt()
sendline("set -l foo bar; echo $foo") sendline("set -l foo bar; echo $foo")
expect_str("bar") expect_prompt("bar")
expect_prompt()
sendline("fg") sendline("fg")
expect_str("Send job 1 (" + testproc + ") to foreground") expect_str("Send job 1 (" + testproc + ") to foreground")
sleep(0.2) sleep(0.2)
sendline("set -l foo bar; echo $foo") sendline("set -l foo bar; echo $foo")
expect_str("") expect_str("")
# ctrl-c - cancel # Beware: Mac pkill requires that the -P argument come before the process name,
send("\x03") # else the -P argument is ignored.
subprocess.call(["pkill", "-INT", "-P", str(sp.spawn.pid), "sleep"])
expect_prompt() expect_prompt()
sendline("set -l foo bar; echo $foo") sendline("set -l foo bar; echo $foo")
expect_str("bar") expect_prompt("bar")
expect_prompt() sendline("echo 'Catch' 'up'")
expect_prompt("Catch up")
# Regression test for #7483. # Regression test for #7483.
# Ensure we can background a job after a different backgrounded job completes. # Ensure we can background a job after a different backgrounded job completes.