Revert expand and s:spawn changes
tempname() is affected by shellslash so expand() is useless. "/c" flag is required to exec a batchfile.
This commit is contained in:
parent
41a49263a6
commit
e5c6dbe2c1
12
plug.vim
12
plug.vim
|
@ -809,7 +809,7 @@ function! s:bang(cmd, ...)
|
||||||
if s:is_win
|
if s:is_win
|
||||||
let batchfile = tempname().'.bat'
|
let batchfile = tempname().'.bat'
|
||||||
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||||
let cmd = s:shellesc(expand(batchfile), &shell)
|
let cmd = s:shellesc(batchfile, &shell)
|
||||||
endif
|
endif
|
||||||
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
|
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
|
||||||
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
||||||
|
@ -1206,11 +1206,11 @@ 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) : a:cmd
|
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)
|
if !empty(job.batchfile)
|
||||||
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
|
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
|
||||||
let argv = s:vim8 ? 'cmd.exe '.s:shellesc(job.batchfile) : ['cmd.exe', job.batchfile]
|
let cmd = s:shellesc(job.batchfile)
|
||||||
endif
|
endif
|
||||||
|
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
|
||||||
|
|
||||||
if s:nvim
|
if s:nvim
|
||||||
call extend(job, {
|
call extend(job, {
|
||||||
|
@ -1227,7 +1227,7 @@ function! s:spawn(name, cmd, opts)
|
||||||
\ 'Invalid arguments (or job table is full)']
|
\ 'Invalid arguments (or job table is full)']
|
||||||
endif
|
endif
|
||||||
elseif s:vim8
|
elseif s:vim8
|
||||||
let jid = job_start(argv, {
|
let jid = job_start(s:is_win ? join(argv, ' ') : argv, {
|
||||||
\ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]),
|
\ 'out_cb': function('s:job_cb', ['s:job_out_cb', job]),
|
||||||
\ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]),
|
\ 'exit_cb': function('s:job_cb', ['s:job_exit_cb', job]),
|
||||||
\ 'out_mode': 'raw'
|
\ 'out_mode': 'raw'
|
||||||
|
@ -2036,7 +2036,7 @@ function! s:system(cmd, ...)
|
||||||
if s:is_win
|
if s:is_win
|
||||||
let batchfile = tempname().'.bat'
|
let batchfile = tempname().'.bat'
|
||||||
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||||
let cmd = s:shellesc(expand(batchfile), &shell)
|
let cmd = s:shellesc(batchfile, &shell)
|
||||||
endif
|
endif
|
||||||
return system(cmd)
|
return system(cmd)
|
||||||
finally
|
finally
|
||||||
|
@ -2370,7 +2370,7 @@ function! s:preview_commit()
|
||||||
if s:is_win
|
if s:is_win
|
||||||
let batchfile = tempname().'.bat'
|
let batchfile = tempname().'.bat'
|
||||||
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
||||||
let cmd = s:shellesc(expand(batchfile), &shell)
|
let cmd = s:shellesc(batchfile, &shell)
|
||||||
endif
|
endif
|
||||||
execute 'silent %!' cmd
|
execute 'silent %!' cmd
|
||||||
finally
|
finally
|
||||||
|
|
Loading…
Reference in New Issue
Block a user