patch 8.2.4078: terminal test for current directory not used on FreeBSD

Problem:    Terminal test for current directory not used on FreeBSD.
Solution:   Make it work on FreeBSD. (Ozaki Kiichi, closes #9516) Add
            TermWait() inside Run_shell_in_terminal() as a generic solution.
diff --git a/src/testdir/term_util.vim b/src/testdir/term_util.vim
index de87dd4..d748ed0 100644
--- a/src/testdir/term_util.vim
+++ b/src/testdir/term_util.vim
@@ -24,6 +24,7 @@
   call term_sendkeys(a:buf, "exit\r")
   let job = term_getjob(a:buf)
   call WaitForAssert({-> assert_equal("dead", job_status(job))})
+  call TermWait(a:buf)
 endfunc
 
 " Wrapper around term_wait() to allow more time for re-runs of flaky tests
@@ -176,6 +177,10 @@
   let string = string({'job': buf->term_getjob()})
   call assert_match("{'job': 'process \\d\\+ run'}", string)
 
+  " On slower systems it may take a bit of time before the shell is ready to
+  " accept keys.  This mainly matters when using term_sendkeys() next.
+  call TermWait(buf)
+
   return buf
 endfunc