Getting the exit code from make in Vim
Just answered the question on SO and I think the final trick is worth documenting here. The problem is how to get after :make
exit code of the make itself. As it is wrapped by VIM, it gets lost in the pipe: :echo v:shell_error
always shows 0 (:h v:shell_error
).
The bash-specific trick is::set shellpipe=2>&1\ \|\ tee\ %s;exit\ \${PIPESTATUS[0]}
The magic is in the ;exit ${PIPESTATUS[0]}
.man bash
(search for PIPESTATUS) and :h 'shellpipe'
(check the %s) for more info.