async: Check directory before starting the job (Neovim)

fixes #1544
This commit is contained in:
Christian Brabandt 2017-08-26 07:58:39 +02:00
parent e357f88de6
commit 3e25ca5a5a
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -166,10 +166,14 @@ elseif has("nvim")
endfunction endfunction
function! airline#async#nvim_get_mq_async(cmd, file) function! airline#async#nvim_get_mq_async(cmd, file)
let cwd = fnamemodify(a:file, ':p:h')
if empty(cwd) || !isdirectory(cwd)
let cwd = getcwd()
endif
let config = { let config = {
\ 'buf': '', \ 'buf': '',
\ 'file': a:file, \ 'file': a:file,
\ 'cwd': fnamemodify(a:file, ':p:h'), \ 'cwd': cwd,
\ 'on_stdout': function('s:nvim_mq_job_handler'), \ 'on_stdout': function('s:nvim_mq_job_handler'),
\ 'on_exit': function('s:nvim_mq_job_handler') \ 'on_exit': function('s:nvim_mq_job_handler')
\ } \ }
@ -187,10 +191,14 @@ elseif has("nvim")
endfunction endfunction
function! airline#async#nvim_get_msgfmt_stat(cmd, file) function! airline#async#nvim_get_msgfmt_stat(cmd, file)
let cwd = fnamemodify(a:file, ':p:h')
if empty(cwd) || !isdirectory(cwd)
let cwd = getcwd()
endif
let config = { let config = {
\ 'buf': '', \ 'buf': '',
\ 'file': a:file, \ 'file': a:file,
\ 'cwd': fnamemodify(a:file, ':p:h'), \ 'cwd': cwd,
\ 'on_stdout': function('s:nvim_po_job_handler'), \ 'on_stdout': function('s:nvim_po_job_handler'),
\ 'on_stderr': function('s:nvim_po_job_handler'), \ 'on_stderr': function('s:nvim_po_job_handler'),
\ 'on_exit': function('s:nvim_po_job_handler') \ 'on_exit': function('s:nvim_po_job_handler')
@ -215,12 +223,16 @@ endif
function! airline#async#nvim_vcs_untracked(cfg, file, vcs) function! airline#async#nvim_vcs_untracked(cfg, file, vcs)
let cmd = a:cfg.cmd . shellescape(a:file) let cmd = a:cfg.cmd . shellescape(a:file)
let id = -1 let id = -1
let cwd = fnamemodify(a:file, ':p:h')
if empty(cwd) || !isdirectory(cwd)
let cwd = getcwd()
endif
let config = { let config = {
\ 'buf': '', \ 'buf': '',
\ 'vcs': a:vcs, \ 'vcs': a:vcs,
\ 'cfg': a:cfg, \ 'cfg': a:cfg,
\ 'file': a:file, \ 'file': a:file,
\ 'cwd': fnamemodify(a:file, ':p:h') \ 'cwd': cwd
\ } \ }
if has("nvim") if has("nvim")
call extend(config, { call extend(config, {