Skip to content

Commit 947f1dd

Browse files
committed
util: catch exceptions trying to execute system commands
1 parent 1df8161 commit 947f1dd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

autoload/go/util.vim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,13 @@ function! go#util#Exec(cmd, ...) abort
198198

199199
" Finally execute the command using the full, resolved path. Do not pass the
200200
" unmodified command as the correct program might not exist in $PATH.
201-
return call('s:exec', [[l:bin] + a:cmd[1:]] + a:000)
201+
try
202+
return call('s:exec', [[l:bin] + a:cmd[1:]] + a:000)
203+
catch
204+
" TODO(bc): return v:exception as the output here or write it with
205+
" go#util#EchoError?
206+
return ['', 1]
207+
endtry
202208
endfunction
203209

204210
function! go#util#ExecInDir(cmd, ...) abort

0 commit comments

Comments
 (0)