Use a list comprehension and try and catch some nasites

This commit is contained in:
Ben Jackson 2019-02-26 15:24:07 +00:00
commit 541686712c
2 changed files with 15 additions and 2 deletions

View file

@ -138,12 +138,16 @@ function! vimspector#internal#job#StartCommandWithLog( cmd, category )
\ 'stoponexit': 'kill'
\ } ) )
if job_status( s:commands[ a:category ][ index ] ) !=# 'run'
echom "Unable to start job for " . a:cmd
return v:none
endif
let l:stdout = ch_getbufnr(
\ job_getchannel( s:commands[ a:category ][ index ] ), 'out' )
let l:stderr = ch_getbufnr(
\ job_getchannel( s:commands[ a:category ][ index ] ), 'err' )
return [ l:stdout, l:stderr ]
endfunction

View file

@ -58,7 +58,16 @@ def SetUpCommandBuffer( cmd, name ):
json.dumps( cmd ),
name ) )
return ( vim.buffers[ bufnr ] for bufnr in bufs )
if bufs is None:
raise RuntimeError( "Unable to start job {}: {}".format( cmd, name ) )
elif not all( [ b > 0 for b in bufs ] ):
raise RuntimeError( "Unable to get all streams for job {}: {}".format(
name,
cmd ) )
UserMessage( 'Bufs: {}'.format( [ int(b) for b in bufs ] ), persist = True )
return [ vim.buffers[ b ] for b in bufs ]
def CleanUpCommand( name ):