Skip to content

Commit

Permalink
firenvim#run(): make sure error messages are sent to stderr
Browse files Browse the repository at this point in the history
Closes #1483
  • Loading branch information
glacambre committed Jan 4, 2023
1 parent aa6311f commit d9a2a73
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions autoload/firenvim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ endfunction
" - Write the security token + tcp port number to stdout()
" - Take care of forwarding messages received on the TCP port to neovim
function! firenvim#run() abort
if !exists('g:firenvim_o')
let g:firenvim_o=[]
endif
" g:Firenvim_oo so far only added on_print messages to g:Firenvim_o,
" so that messages emitted before firenvim is loaded could be caught.
" When firenvim#run() is called, we know Firenvim has been properly
" loaded by the user's plugin manager, and so we can redefine it to
" send messages to stderr
let g:Firenvim_oo={t->chansend(2,[string(t)]+add(g:firenvim_o,t))}
if len(g:firenvim_o) > 0
call chansend(2,string(g:firenvim_o))
endif
" Write messages to stdout according to the format expected by
" Firefox's native messaging protocol
function! WriteStdout(id, data) abort
Expand Down

0 comments on commit d9a2a73

Please sign in to comment.