Skip to content

Commit f4741a0

Browse files
committed
Set shell to cmd.exe with flag /C before running system command on
windows. Fixes fatih#2712.
1 parent d698de4 commit f4741a0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

autoload/go/util.vim

+8
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ function! s:system(cmd, ...) abort
162162
set shell=/bin/sh shellredir=>%s\ 2>&1 shellcmdflag=-c
163163
endif
164164

165+
if go#util#IsWin()
166+
let l:cmdexe=go#util#Join($SYSTEMROOT, 'System32', 'cmd.exe')
167+
if executable(l:cmdexe)
168+
let &shell = l:cmdexe
169+
set shellcmdflag=/C
170+
endif
171+
endif
172+
165173
try
166174
return call('system', [a:cmd] + a:000)
167175
finally

0 commit comments

Comments
 (0)