Vim job execs batchfile via cmd.exe

This commit is contained in:
Jan Edmund Lazo 2019-07-23 18:56:08 -04:00
parent 8754b3ed74
commit 41a49263a6

View File

@ -1206,11 +1206,11 @@ function! s:spawn(name, cmd, opts)
\ 'new': get(a:opts, 'new', 0) }
let s:jobs[a:name] = job
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
if !empty(job.batchfile)
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
let cmd = s:shellesc(expand(job.batchfile), &shell)
let argv = s:vim8 ? 'cmd.exe '.s:shellesc(job.batchfile) : ['cmd.exe', job.batchfile]
endif
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
if s:nvim
call extend(job, {
@ -1227,7 +1227,7 @@ function! s:spawn(name, cmd, opts)
\ 'Invalid arguments (or job table is full)']
endif
elseif s:vim8
let jid = job_start(s:is_win ? join(argv, ' ') : argv, {
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]),
\ 'out_mode': 'raw'