48 Commits

Author SHA1 Message Date
mattn
2082d13bb1 passing env to async#job#start (#49)
* passing env to async#job#start

* fix test
2022-04-05 02:37:26 +09:00
Prabir Shrestha
f20569020d add support for choosing between array/string/raw for the stderr or stdout data (#47)
One of the big mistakes I did in designing async.vim was to default to neovim output. Most of the time you need to get string and his can be costly for vim, since vim by default returns a string, which means we call split in async.vim then the consumer calls join which should had ideally been a noop. This allocates unnecessary memory due to string and array creation. Luckily we can have 100% backwards compatibility as I still default to 'array' if not passed and one can easily override it to 'string'. For callbag.vim's spawn function I had defaulted to 'raw' and make the user decide if they want compatibility.
2022-01-03 18:18:12 -08:00
Prabir Shrestha
0fb846e1eb avoid has_key check for on_stdout 2021-03-21 11:29:42 -07:00
Yasuhiro Matsumoto
c4d61443ca Set waittime 2020-12-30 14:50:52 +09:00
Yasuhiro Matsumoto
8fc59562f0 Increment l:retry 2020-12-30 14:46:44 +09:00
Yasuhiro Matsumoto
f6b87c19cc Trim null 2020-12-30 14:46:41 +09:00
Yasuhiro Matsumoto
fa1b82d8c2 Retry 2020-12-29 02:52:18 +09:00
Yasuhiro Matsumoto
a4f4005da8 Add async#job#connect 2020-12-29 01:35:08 +09:00
Prabir Shrestha
6102020b46 Add :AsyncEmbed 2020-06-20 15:44:26 -07:00
Matteo Landi
d15123af34 Add default value when reading 'close_stdin' from input options 2020-06-13 03:13:16 -07:00
Matteo Landi
bb3aceb01a Make opts argument of async#job#send, optional 2020-06-13 03:13:16 -07:00
Matteo Landi
732cf4896a Pass close_stdin as a Dictionary rather than bool argument 2020-06-13 03:13:16 -07:00
Matteo Landi
ab499e8fef Better / safer management of non-blocking channels 2020-06-13 03:13:16 -07:00
Matteo Landi
a0f4e4e91c Wait for transmit buffer to be empty, before calling ch_close_in 2020-06-13 03:13:16 -07:00
Matteo Landi
ada658f2c8 Add support for sending data and closing stdin at the same time
An additional optional parameter was added to `async#job#send` that user
can use (i.e. passing in a truthy value) to close stdin right after data
transfer.
2020-06-13 03:13:16 -07:00
d86leader
42371b5fb2 fix not restoring cpoptions 2020-04-25 08:18:41 -07:00
Yoni Weill
f67ecb5a11 Support 'cwd' option in jobstart 2020-01-01 18:21:35 -08:00
lambdalisue
627a8c4092 Do NOT remove job in job_stop but on_exit
Whe job_stop() is called,

Previous behavior:

    Vim:
    The target job is removed from s:jobs in 'exit_cb' IMMEDIATELY
    after job_stop() has called.

    Neovim:
    The target job is removed from s:jobs in 'job_stop()' because
    'on_exit' callback is not IMMEDIATELY called after jobstop().
    That's why the target job is missing when 'on_exit' callback
    has called.

Fixed behavior:

    Vim:
    The target job is removed from s:jobs in 'exit_cb' IMMEDIATELY
    after job_stop() has called.

    Neovim:
    The target job is removed from s:jobs in 'on_exit' after
    jobstop() has called.
    The target job still exists when 'on_exit' callback is called.
2019-07-17 21:29:12 -07:00
lambdalisue
91c3f2b315 Do NOT raise E900 on invalid jobid 2019-07-17 21:29:12 -07:00
mattn
8da445be74 default to noblock if supported by vim 8 to avoid deadlocks causing vim to hang (#31) 2019-02-11 12:20:13 -08:00
mattn
4bde72e27e Don't use workaround (#30) 2019-01-24 17:56:53 -08:00
Prabir Shrestha
ff9177ccae add async#job#pid() (#28)
* add async#job#pid()

* fix type check

* added link to jobpid
2019-01-13 16:09:44 -08:00
Yasuhiro Matsumoto
c980166818 Revert #22
It is need to consider again
2019-01-10 17:58:52 +09:00
Yasuhiro Matsumoto
ca41dab8b3 Buffer size must be more large 2019-01-10 01:19:21 +09:00
Yasuhiro Matsumoto
d10fdb9b34 Start timer to read lazy 2019-01-09 14:56:14 +09:00
Yasuhiro Matsumoto
89bec954b8 Add "sleep 1m" to read blocked channel 2019-01-09 13:42:43 +09:00
bmtsstl
8eae0c4d5d Don't use timer_start(0, ...) (#20)
https://github.com/vim/vim/pull/2116
2018-12-22 18:37:35 -08:00
K.Takata
c5b236ffbe Fix that async#job#wait() always returns 0 (#17)
Use 'return' instead of 'call' to fix it.
2018-08-25 09:43:27 -07:00
Prabir Shrestha
f29f6167a1 buffer vim ch_sendraw to avoid deadlocks (#15)
https://github.com/vim/vim/issues/2548
https://github.com/natebosch/vim-lsc/issues/67#issuecomment-357469091
2018-01-28 11:42:51 -08:00
Linda_pp
699bbdcf1d Embed the license to file to make drop-in easier (#14)
This library is distributed with MIT license. It requires to show the
copyright notice in software. So when embedding this library in a plugin,
a user also needs to show the copyright in the plugin.

By embedding a license description and copyright notice to source file,
a user doesn't need to take care about license notice because it is
already put in the source file.
2018-01-18 21:20:04 -08:00
K.Takata
86655b3b14 Fix vint warning
> Prefer single quoted strings (see Google VimScript Style Guide (Strings))
2017-07-18 21:58:23 -07:00
K.Takata
f49fc0efbd Implement jobwait() 2017-07-18 21:58:23 -07:00
Prabir Shrestha
70aef293bd fix lint issues 2017-07-10 20:52:40 -07:00
Prabir Shrestha
b8289cecb1 enable vim8 support without lambda 2017-07-10 20:52:40 -07:00
Prabir Shrestha
ec6d4781cb fixed type() check 2017-03-28 21:29:10 -07:00
Prabir Shrestha
b117c859a8 keep empty when spliting stdout and stderr for vim 2016-12-31 12:08:20 -08:00
Prabir Shrestha
90d21ad2ed fix variable name 2016-12-26 19:43:15 -08:00
Prabir Shrestha
ada1a95dbb added function! 2016-12-25 13:03:48 -08:00
Prabir Shrestha
b9cc2472ca if job fails to start don't add it in jobs table (fixes #5) 2016-12-25 11:08:21 -08:00
Prabir Shrestha
7be6e7a4a7 added abort 2016-12-24 13:24:52 -08:00
Prabir Shrestha
b325151af1 vim split on \n so it behaves like neovim 2016-11-05 22:29:43 -07:00
Prabir Shrestha
44ddf1b37f refactor take 2 2016-11-05 20:15:18 -07:00
John Schwarz
901ea94ef9 fix a bug where 'send' called 'job_stop' 2016-06-17 21:02:52 +03:00
Prabir Shrestha
8a858aede7 fallback to system() when job isn't supported 2016-03-20 22:37:00 -07:00
Prabir Shrestha
6f745d15dd normalize vim job data as list 2016-03-20 15:24:58 -07:00
Prabir Shrestha
0843695010 support async#job#start for vim with +job 2016-03-20 15:06:23 -07:00
Prabir Shrestha
576eeec1ac initial neovim job-control support 2016-03-20 12:30:27 -07:00
Prabir Shrestha
1b2b15e1ee added empty autoload/async/job.vim 2016-03-20 11:50:15 -07:00