endif
func OutCb(chan, msg)
+ let g:val += 1
endfunc
func ExitCb(job, status)
- let g:val = 1
+ let g:val += 1
call Resume()
endfunc
call timer_start(1, 'TimerCb')
let elapsed = Standby(&ut)
call assert_inrange(1, &ut / 2, elapsed)
+
+ " Wait for both OutCb() and ExitCb() to have been called before deleting
+ " them.
+ call WaitForAssert({-> assert_equal(2, g:val)})
call job_stop(g:job)
delfunc OutCb
endfunc
func Test_terminal_no_cmd()
- " Does not work on Mac.
- if has('mac')
- return
- endif
let buf = term_start('NONE', {})
call assert_notequal(0, buf)
let pty = job_info(term_getjob(buf))['tty_out']
call assert_notequal('', pty)
- if has('win32')
- silent exe '!start cmd /c "echo look here > ' . pty . '"'
- else
+ if has('gui_running') && !has('win32')
+ " In the GUI job_start() doesn't work, it does not read from the pty.
call system('echo "look here" > ' . pty)
+ else
+ " Otherwise using a job works on all systems.
+ call job_start([&shell, &shellcmdflag, 'echo "look here" > ' . pty])
endif
call WaitForAssert({-> assert_match('look here', term_getline(buf, 1))})