Fix Vim 8 installer on Windows when path contains spaces

Close #565
This commit is contained in:
Junegunn Choi 2017-01-29 18:23:05 +09:00
parent 5fc9eab788
commit d6bda025f1
No known key found for this signature in database
GPG key ID: 254BC280FEF9C627

View file

@ -1143,6 +1143,9 @@ endfunction
function! s:job_exit_cb(self, data) abort
let a:self.running = 0
let a:self.error = a:data != 0
if has_key(a:self, 'tempname')
call delete(a:self.tempname)
endif
call s:reap(a:self.name)
call s:tick()
endfunction
@ -1164,8 +1167,8 @@ function! s:spawn(name, cmd, opts)
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
\ 'new': get(a:opts, 'new', 0) }
let s:jobs[a:name] = job
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'],
\ has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd)
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
let argv = s:is_win ? cmd : ['sh', '-c', cmd]
if s:nvim
call extend(job, {
@ -1182,6 +1185,11 @@ function! s:spawn(name, cmd, opts)
\ 'Invalid arguments (or job table is full)']
endif
elseif s:vim8
if s:is_win
let job.tempname = tempname().'.bat'
call writefile([argv], job.tempname)
let argv = job.tempname
endif
let jid = job_start(argv, {
\ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]),
\ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]),