11" Vim auto-load script
22" Author: Peter Odding <peter@peterodding.com>
3- " Last Change: June 14 , 2011
3+ " Last Change: June 17 , 2011
44" URL: http://peterodding.com/code/vim/shell/
55
66if ! exists (' s:script' )
@@ -108,8 +108,8 @@ function! xolox#shell#execute(command, synchronous, ...) " -- execute external c
108108 let cmd = &shell . ' ' . &shellcmdflag . ' ' . cmd
109109 let error = s: library_call (fn, cmd)
110110 if error != ' '
111- let msg = ' %s: %s (%s) failed! (error: %s)'
112- throw printf (msg, s: script , fn, strtrans (cmd), strtrans (error ))
111+ let msg = ' %s(%s) failed! (error: %s)'
112+ throw printf (msg, fn, strtrans (cmd), strtrans (error ))
113113 endif
114114 else
115115 if has (' unix' ) && ! a: synchronous
@@ -118,11 +118,12 @@ function! xolox#shell#execute(command, synchronous, ...) " -- execute external c
118118 call s: handle_error (cmd, system (cmd))
119119 endif
120120 if a: synchronous
121- if ! filereadable (tempout)
122- let msg = ' %s: Failed to execute %s!'
123- throw printf (msg, s: script , strtrans (cmd))
124- endif
125- return readfile (tempout)
121+ try
122+ return readfile (tempout)
123+ catch
124+ let msg = ' Failed to get output of command "%s"!'
125+ throw printf (msg, strtrans (cmd))
126+ endtry
126127 else
127128 return 1
128129 endif
0 commit comments