Skip to content

Commit

Permalink
Pause after :Start command failure
Browse files Browse the repository at this point in the history
On UNIX, an exception is made for interrupts, exit status 130.  On
Windows, exit status for interrupt appears to vary, so pausing happens
on any failure.
  • Loading branch information
tpope committed May 10, 2015
1 parent 4d9ec73 commit 45abeb1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion autoload/dispatch.vim
Expand Up @@ -152,6 +152,10 @@ function! dispatch#prepare_start(request, ...) abort
let exec .= 'sleep 1; '
endif
let exec .= a:0 ? a:1 : a:request.expanded
let pause = "(printf '\e[1m--- Press ENTER to continue ---\e[0m\\n' $?; exec head -1)"
if a:0 < 2 || a:2 =~# 'always\|error\|[1-9]'
let exec .= "; test $? = 0 -o $? = 130 || " . pause
endif
let callback = dispatch#callback(a:request)
let after = 'rm -f ' . a:request.file . '.pid; ' .
\ 'touch ' . a:request.file . '.complete' .
Expand All @@ -166,7 +170,7 @@ endfunction

function! dispatch#prepare_make(request, ...) abort
let exec = a:0 ? a:1 : (a:request.expanded . dispatch#shellpipe(a:request.file))
return dispatch#prepare_start(a:request, exec, 1)
return dispatch#prepare_start(a:request, exec, 'never')
endfunction

function! dispatch#set_title(request) abort
Expand Down
1 change: 1 addition & 0 deletions autoload/dispatch/windows.vim
Expand Up @@ -62,6 +62,7 @@ function! dispatch#windows#start(request) abort
let exec =
\ s:pid . pidfile .
\ ' & ' . a:request.command .
\ ' || pause ' .
\ ' & cd . > ' . a:request.file . '.complete' .
\ ' & del ' . pidfile
endif
Expand Down

0 comments on commit 45abeb1

Please sign in to comment.