aboutsummaryrefslogtreecommitdiff
path: root/src/os/job.c
Commit message (Collapse)AuthorAge
* Introduce nvim namespace: Move files.Eliseo Martínez2014-05-15
| | | | | | Move files from src/ to src/nvim/. - src/nvim/ becomes the new root dir for nvim executable sources. - src/libnvim/ is planned to become root dir of the neovim library.
* Add channel moduleThiago de Arruda2014-05-12
| | | | | | - Add channel module that exposes the API over arbitrary streams - Add `xmemdup` for duplicating memory chunks - Make job exit callback optional
* Refactor modules to use handle data accessorsThiago de Arruda2014-05-12
| | | | The job, rstream and wstream modules now use handle data accessors
* Fix bug of `job_stop` not emitting `JobExit`Thiago de Arruda2014-04-18
| | | | | | The `job_stop` function was calling `uv_read_stop` on the std{out,err} streams. This is now responsibility of `RStream` and because of those calls `job_stop` wasn't emitting the `JobExit` event.
* Remove unnecessary cleanup label from `job_start`Thiago de Arruda2014-04-18
| | | | The argument vector is now freed in the `close_cb` function in job.c
* Free job data on close_cbThiago de Arruda2014-04-18
|
* Stop job prepare watcher when there are no jobsThiago de Arruda2014-04-18
| | | | No need to check for job status when no jobs are running
* Refactor job.c module to use WStreamThiago de Arruda2014-04-18
| | | | | After a job has accumulated 1mb of stdin data we assume that it's stuck and kill it.
* Correctly free libuv handlesThiago de Arruda2014-04-18
| | | | | This ensures memory chunks for libuv handles are only freed after the event loop no longer has references to it.
* Refactor job control to use RStream eventsThiago de Arruda2014-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of a single 'job read' callback, job control consumers need to provide callbacks for "stdout read", "stderr read" and "exit". For vimscript, the JobActivity autocommand is still used to handle every job event, for example: ```vim :let srv1_id = jobstart('netcat-server-1', 'nc', ['-l', '9991']) :let srv2_id = jobstart('netcat-server-2', 'nc', ['-l', '9991']) function JobEvent() " v:job_data[0] = the job id " v:job_data[1] = the event type, one of "stdout", "stderr" or "exit" " v:job_data[2] = data read from stdout or stderr if v:job_data[1] == 'stdout' let str = 'Message from job '.v:job_data[0].': '.v:job_data[2] elseif v:job_data[1] == 'stderr' let str = 'Error message from job '.v:job_data[0].': '.v:job_data[2] else " Exit let str = 'Job '.v:job_data[0].' exited' endif call append(line('$'), str) endfunction au JobActivity netcat-server-* call JobEvent() ``` And to see messages from 'job 1', run in another terminal: ```sh bash -c "while true; do echo 123; sleep 1; done" | nc localhost 9991 ```
* Create EventType for RStream readingThiago de Arruda2014-04-18
| | | | | | | RStream will be the main way Neovim receives asynchronous messages, so it is best to have a specialized EventType for it. A new flag parameter was added to `rstream_new` which tells the RStream instance to defer event handling for later with KE_EVENT instead of handling it directly from libuv callback.
* Refactor job control module to use RStream classThiago de Arruda2014-04-16
|
* Bring neovim up to date with recent libuv changesWill Tange2014-04-14
| | | | | | | | | As of v0.11.23 libuv's uv_timer_cb, uv_async_cb, uv_prepare_cb, uv_check_cb and uv_idle_cb no longer require a status parameter (this went unused in the first place). Bump third-party dependency `libuv` up to 0.11.23 and remove the extra parameters from the callbacks.
* Remove old comment from job.cThiago de Arruda2014-04-08
|
* Define special key for asynchronous eventsThiago de Arruda2014-04-08
| | | | | | | | | | | | | | | | | | | | | | K_EVENT/KE_EVENT are used to signal any loop that reads user input(scattered across normal.c edit.c , ex_getln.c and message.c) of asynchronous events that were not initiated by the user. Representing non-user asynchronous events as special keys has the following advantages: - We reuse the normal vim redrawing code. As far as the rest of the code in edit.c/normal.c is concerned, it's just the user pressing another key. - Assume less about vim tolerance for "out-of-band" modifications to its internal state. - We still have a very complex codebase and it's hard to predict what bugs may be introduced by these changes. With this we implement asynchronicity in a way that will be more "natural" to the editor and has less chance of causing unpredictable behavior. As the code is refactored, we will be able to treat user input as an 'event type' and not the other way around(With this we are treating arbitrary events as a special case of user input).
* Fix/add more files with to clint-files.txtThiago de Arruda2014-04-08
|
* Implement job controlThiago de Arruda2014-04-07
- Add a job control module for spawning and controlling co-processes - Add three vimscript functions for interfacing with the module - Use dedicated header files for typedefs/structs in event/job modules