809 " but it won't work on Windows. |
809 " but it won't work on Windows. |
810 let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd |
810 let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd |
811 if s:is_win |
811 if s:is_win |
812 let batchfile = tempname().'.bat' |
812 let batchfile = tempname().'.bat' |
813 call writefile(["@echo off\r", cmd . "\r"], batchfile) |
813 call writefile(["@echo off\r", cmd . "\r"], batchfile) |
814 let cmd = batchfile |
814 let cmd = s:shellesc(batchfile) |
815 endif |
815 endif |
816 let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') |
816 let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') |
817 execute "normal! :execute g:_plug_bang\<cr>\<cr>" |
817 execute "normal! :execute g:_plug_bang\<cr>\<cr>" |
818 finally |
818 finally |
819 unlet g:_plug_bang |
819 unlet g:_plug_bang |
1208 \ 'new': get(a:opts, 'new', 0) } |
1208 \ 'new': get(a:opts, 'new', 0) } |
1209 let s:jobs[a:name] = job |
1209 let s:jobs[a:name] = job |
1210 let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd |
1210 let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd |
1211 if !empty(job.batchfile) |
1211 if !empty(job.batchfile) |
1212 call writefile(["@echo off\r", cmd . "\r"], job.batchfile) |
1212 call writefile(["@echo off\r", cmd . "\r"], job.batchfile) |
1213 let cmd = job.batchfile |
1213 let cmd = s:shellesc(job.batchfile) |
1214 endif |
1214 endif |
1215 let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd) |
1215 let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd) |
1216 |
1216 |
1217 if s:nvim |
1217 if s:nvim |
1218 call extend(job, { |
1218 call extend(job, { |
2035 let [sh, shellcmdflag, shrd] = s:chsh(1) |
2035 let [sh, shellcmdflag, shrd] = s:chsh(1) |
2036 let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd |
2036 let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd |
2037 if s:is_win |
2037 if s:is_win |
2038 let batchfile = tempname().'.bat' |
2038 let batchfile = tempname().'.bat' |
2039 call writefile(["@echo off\r", cmd . "\r"], batchfile) |
2039 call writefile(["@echo off\r", cmd . "\r"], batchfile) |
2040 let cmd = batchfile |
2040 let cmd = s:shellesc(batchfile) |
2041 endif |
2041 endif |
2042 return system(s:is_win ? '('.cmd.')' : cmd) |
2042 return system(cmd) |
2043 finally |
2043 finally |
2044 let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] |
2044 let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd] |
2045 if s:is_win |
2045 if s:is_win |
2046 call delete(batchfile) |
2046 call delete(batchfile) |
2047 endif |
2047 endif |