mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-21 16:15:41 +08:00
23 lines
519 B
Plaintext
23 lines
519 B
Plaintext
Execute ( SpaceVim api: job ):
|
|
let job = SpaceVim#api#import('job')
|
|
let argv = ['echo', 'foo']
|
|
let stdout = ''
|
|
let exit = 1
|
|
function! s:on_stdout(id, data, event) abort
|
|
if a:event ==# 'stdout'
|
|
let g:stdout = a:data[0]
|
|
elseif a:event ==# 'exit'
|
|
let g:exit = a:data
|
|
endif
|
|
endfunction
|
|
let opt = {
|
|
\ 'on_stdout' : function('s:on_stdout'),
|
|
\ 'on_exit' : function('s:on_stdout'),
|
|
\ }
|
|
call job.start(argv,opt)
|
|
sleep 10m
|
|
AssertEqual stdout, 'foo'
|
|
AssertEqual exit, 0
|
|
|
|
|