Gary Johnson
unread,Nov 29, 2016, 7:56:41 PM11/29/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vim...@googlegroups.com
I was working on a plugin in which I wanted to capture the exit
status of my 'makeprg', preferably using v:shell_error. The trouble
was that on Unix, 'shellpipe' is "2>&1| tee", so that following
:make, v:shell_error contained the exit status of tee and not of
'makeprg'.
I solved the problem by using bash's PIPESTATUS array variable to
access the exit status of the first command in the :make pipeline
and modifying 'shellpipe' to exit with that status.
let l:save_sp = &shellpipe
let &shellpipe .= " %s; exit ${PIPESTATUS[0]}"
make
" v:shell_error now contains the exit status of 'makeprg'.
let &shellpipe = l:save_sp
Let me know if there's a better way to do that. In the meantime,
I hope someone finds that useful.
Regards,
Gary