There is another problem on unix environment:
When a job is unreferenced, detection of job-completed is delayed.
[repro steps]
test.vim
----
fu! ExitCb(job, status)
echom 'exited' reltimestr(reltime(s:elapsed))
endfu
let s:elapsed = reltime()
call job_start('sleep 1', {'exit_cb': 'ExitCb'})
----
vim -Nu NONE -S test.vim
exited 4.008510
Delay is about 4sec ~ 6sec.
[cause]
https://github.com/vim/vim/blob/7756e74/src/os_unix.c#L425-L435
https://github.com/vim/vim/blob/7756e74/src/os_unix.c#L496-L504
Generally, job-channel EOF makes WaitForChar return and detect job-completed
promptly.
An unreferenced job loses own channel, so vim can't detect job-channel EOF.
[patch]
https://gist.github.com/ichizok/c7daad6267816173ac5c38f4c8848dd2
- Check job-completed every 100msec (same as on Windows) when has_pending_job()
is TRUE.
- Change has_pending_job(); checks whether there is any job which is running,
has exit_cb, and doesn't have own job-channel or useful-channel
(channel_still_useful() is FALSE).
- Add test helper functions: Standby() and Resume() to shared.vim.
Standby() keep process waiting by getchar(), Resume() resumes process by
feedkeys(). Resume() must be called in callback.
# bacause... command-:sleep checks job-completed every 100msec, it inhibits
# test failing before applying fix.
Thank you.
- Ozaki Kiichi
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.