Internalize shellredir for s:spawn

s:spawn needs to redirect stderr to stdout for jobs callbacks
but s:system (for old Vim versions) sets shellredir if needed.
This commit is contained in:
Jan Edmund Lazo 2020-04-08 20:03:19 -04:00
parent d9f7328268
commit b59a1e83cd
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -1281,7 +1281,7 @@ function! s:spawn(name, cmd, opts)
\ 'new': get(a:opts, 'new', 0) } \ 'new': get(a:opts, 'new', 0) }
let s:jobs[a:name] = job let s:jobs[a:name] = job
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir, 0) : a:cmd let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir, 0) : a:cmd
let argv = s:is_win ? ['cmd', '/s', '/c', '"'.cmd.'"'] : ['sh', '-c', cmd] let argv = s:is_win ? ['cmd', '/s', '/c', '"'.cmd.' 2>&1"'] : ['sh', '-c', cmd.' 2>&1']
if s:nvim if s:nvim
call extend(job, { call extend(job, {
@ -1409,7 +1409,7 @@ while 1 " Without TCO, Vim stack is bound to explode
if empty(error) if empty(error)
if pull if pull
let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : '' let fetch_opt = (has_tag && !empty(globpath(spec.dir, '.git/shallow'))) ? '--depth 99999999' : ''
call s:spawn(name, printf('git fetch %s %s 2>&1', fetch_opt, prog), { 'dir': spec.dir }) call s:spawn(name, printf('git fetch %s %s', fetch_opt, prog), { 'dir': spec.dir })
else else
let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 } let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
endif endif
@ -1418,7 +1418,7 @@ while 1 " Without TCO, Vim stack is bound to explode
endif endif
else else
call s:spawn(name, call s:spawn(name,
\ printf('git clone %s %s %s %s 2>&1', \ printf('git clone %s %s %s %s',
\ has_tag ? '' : s:clone_opt, \ has_tag ? '' : s:clone_opt,
\ prog, \ prog,
\ plug#shellescape(spec.uri, {'script': 0}), \ plug#shellescape(spec.uri, {'script': 0}),