mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 08:51:14 -03:00
pexpects/wait: wait on the same line as the background jobs
The issue here is we start some short `sleep`s in the background, wait for a prompt, and only *then* wait for jobs, and *then* check for the job end output. That means if the prompt takes too long, we'll read the job end messages with the `expect_prompt`. Instead of increasing the timeouts, just wait on the same line and remove that prompt.
This commit is contained in:
@@ -28,9 +28,7 @@ sendline("jobs")
|
||||
expect_prompt("jobs: There are no jobs")
|
||||
|
||||
# three job ids specified
|
||||
sendline("sleep 0.5 &; sleep 0.1 &; sleep 0.3 &; sleep 0.7 &;")
|
||||
expect_prompt()
|
||||
sendline("wait %1 %3 %4")
|
||||
sendline("sleep 0.5 &; sleep 0.1 &; sleep 0.3 &; sleep 0.7 &; wait %1 %3 %4")
|
||||
expect_str("Job 2, 'sleep 0.1 &' has ended")
|
||||
expect_str("Job 3, 'sleep 0.3 &' has ended")
|
||||
expect_str("Job 1, 'sleep 0.5 &' has ended")
|
||||
@@ -39,9 +37,7 @@ sendline("jobs")
|
||||
expect_prompt("jobs: There are no jobs")
|
||||
|
||||
# specify job ids with -n option
|
||||
sendline("sleep 0.5 &; sleep 0.1 &; sleep 0.3 &")
|
||||
expect_prompt()
|
||||
sendline("wait -n %1 %3")
|
||||
sendline("sleep 0.5 &; sleep 0.1 &; sleep 0.3 &; wait -n %1 %3")
|
||||
expect_str("Job 2, 'sleep 0.1 &' has ended")
|
||||
expect_prompt("Job 3, 'sleep 0.3 &' has ended")
|
||||
sendline("wait -n %1")
|
||||
|
||||
Reference in New Issue
Block a user