Use a timer to periodically compare the current HR time against the HR time of
when `job_stop` was called. After 1 second, send SIGTERM, after 2 seconds, send
SIGKILL. The timer is only active when there's at least one `job_stop` call
pending.
Passing NULL as the callback for stdout/stderr will result in job_start ignoring
stdout/stderr, respectively. A 'writable' boolean argument was also added, and
when false `job_start` will ignore stdin.
Also, refactor os_system to allow passing NULL as the `output` argument.
Commit @709685b4612f4 removed the close_job_* calls when uv_spawn fails because
of memory errors when trying to cleanup unitialized {R,W}Stream instances, but
the uv_pipe_t instances must be closed because they are added to the event loop
queue by previous `uv_pipe_init()` calls
Problem: executable() was detecting python on user's path, but
system() was executing system-level python.
Solution: Make sure python version on user's path is executed.
Use exepath() to force system() to do so.
The `vim_feedkeys` must be deferred because it can potentially free the buffer
passed to `os_inchar`(which in turns calls `vim_feedkeys` indirectly).
The new `vim_input` function can be used to emulate user input(Since it does not
mess with the typeahead, it is safe to execute without deferring).
- Extract `process_interrupts` out of `convert_input`
- Instead of waiting for os_breakcheck/os_inchar calls, call `convert_input`
and `process_interrupts` directly from the read callback in input.c.
- Remove the `settmode` calls from `job_wait`. Now that interrupts are
processed in the event loop, there's no need to set the terminal to cooked
which introduces other problems(ref 7.4.427)
Since the introduction of the FOR_ALL_BUFFERS macro, 'sign unplace id'
without a buffer was only removing the sign from the first buffer rather
than all buffers, as described in the documentation.
:help sign-unplace
--
modeline discussion: https://github.com/akkartik/neovim/commit/7863c247db#commitcomment-8342590
The JobEvent structure may refer to a job after it has been freed. Apply
@tarruda's patch to extract the job data before pushing the event.
Also, fix the type, "data" -> "job", in on_job_exit() and free the job
name in the last job event.
- Move the cleanup function definition into `restart()` so restart can be
selectively used as a hook
- Improve error handling: Before this, errors while running the event loop would
cause busted to get stuck. Now the error is properly raised by stopping the
event loop first.