Skip to content

Commit

Permalink
Include stdout/stderr for servers which we use a socket to communicate
Browse files Browse the repository at this point in the history
  • Loading branch information
puremourning committed May 30, 2023
1 parent 168fa06 commit e405c00
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions autoload/vimspector/internal/channel.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ let s:save_cpo = &cpoptions
set cpoptions&vim
" }}}

" Key: session_id
" Value: channel id
let s:channels = {}

" Key: session_id
" Value: job id
let s:jobs = {}

function! s:_OnServerData( session_id, channel, data ) abort
Expand All @@ -44,6 +49,17 @@ function! s:_OnClose( session_id, channel ) abort
py3 _VimspectorSession( vim.eval( 'a:session_id' ) ).OnServerExit( 0 )
endfunction

function! s:_OnJobStdErr( session_id, channel, data ) abort
if !has_key( s:jobs, a:session_id ) ||
\ ch_getjob( a:channel ) isnot s:jobs[ a:session_id ]
call ch_log( 'Get data after process exit' )
return
endif

py3 _VimspectorSession( vim.eval( 'a:session_id' ) ).OnServerStderr(
\ vim.eval( 'a:data' ) )
endfunction

function! vimspector#internal#channel#StartDebugSession(
\ session_id,
\ config ) abort
Expand All @@ -62,6 +78,10 @@ function! vimspector#internal#channel#StartDebugSession(
\ 'out_mode': 'raw',
\ 'err_mode': 'raw',
\ 'stoponexit': 'term',
\ 'out_cb': funcref( 's:_OnJobStdErr',
\ [ a:session_id ] ),
\ 'err_cb': funcref( 's:_OnJobStdErr',
\ [ a:session_id ] ),
\ 'env': a:config[ 'env' ],
\ 'cwd': a:config[ 'cwd' ],
\ }
Expand Down

0 comments on commit e405c00

Please sign in to comment.