aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--autoload/xolox/misc/compat.vim2
-rw-r--r--autoload/xolox/misc/os.vim24
2 files changed, 18 insertions, 8 deletions
diff --git a/autoload/xolox/misc/compat.vim b/autoload/xolox/misc/compat.vim
index c950ad6..56aff62 100644
--- a/autoload/xolox/misc/compat.vim
+++ b/autoload/xolox/misc/compat.vim
@@ -7,7 +7,7 @@
" scripts breaks backwards compatibility. This enables my Vim plug-ins to fail
" early when they detect an incompatible version, instead of breaking at the
" worst possible moments :-).
-let g:xolox#misc#compat#version = 4
+let g:xolox#misc#compat#version = 5
" Remember the directory where the miscellaneous scripts are loaded from
" so the user knows which plug-in to update if incompatibilities arise.
diff --git a/autoload/xolox/misc/os.vim b/autoload/xolox/misc/os.vim
index 8add797..032d2c8 100644
--- a/autoload/xolox/misc/os.vim
+++ b/autoload/xolox/misc/os.vim
@@ -87,19 +87,29 @@ function! xolox#misc#os#exec(options) " {{{1
endif
- let result = {}
+ " Return the results as a dictionary with one or more key/value pairs.
+ let result = {'command': cmd}
if !async
+ let result['exit_code'] = exit_code
+ let result['stdout'] = s:readfile(tempout)
+ let result['stderr'] = s:readfile(temperr)
" If we just executed a synchronous command and the caller didn't
" specifically ask us *not* to check the exit code of the external
" command, we'll do so now.
if get(a:options, 'check', 1) && exit_code != 0
- let msg = "os.vim %s: External command failed with exit code %d: %s"
- throw printf(msg, g:xolox#misc#os#version, result['exit_code'], result['command'])
+ " Prepare an error message with enough details so the user can investigate.
+ let msg = printf("os.vim %s: External command failed with exit code %d!", g:xolox#misc#os#version, result['exit_code'])
+ let msg .= printf("\nCommand line: %s", result['command'])
+ " If the external command reported an error, we'll include it in our message.
+ if !empty(result['stderr'])
+ " This is where we would normally expect to find an error message.
+ let msg .= printf("\nOutput on standard output stream:\n%s", join(result['stderr'], "\n"))
+ elseif !empty(result['stdout'])
+ " Exuberant Ctags on Windows XP reports errors on standard output :-x.
+ let msg .= printf("\nOutput on standard error stream:\n%s", join(result['stdout'], "\n"))
+ endif
+ throw msg
endif
- " Return the results as a dictionary with three key/value pairs.
- let result['exit_code'] = exit_code
- let result['stdout'] = s:readfile(tempout)
- let result['stderr'] = s:readfile(temperr)
endif
return result