roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Added way to inspect source proc stdout/stderr #95

Closed vietjtnguyen closed 7 years ago

vietjtnguyen commented 7 years ago

This is a result of my effort detailed in https://github.com/roxma/clang_complete/pull/6

I found it useful to get the stdout and stderr from the source processes to debug why a source process might be dead. I figure being able to enable/disable that without a source change would be a convenient addition to the trouble shooting wiki.

Feel free to bike shed names and whatnot.

roxma commented 7 years ago

It should be better to use proc = subprocess.Popen(cmd,stdin=subprocess.DEVNULL,stdout=sys.stdout,stderr=sys.stderr).

Because the default threading sources already have this behavior.

This update came up to me a few times. But after a wile I forgot to chage it.

Thanks.

vietjtnguyen commented 7 years ago

You mean changing it permanently to share stdout and stderr instead of putting it behind an environment variable?

roxma commented 7 years ago

You mean changing it permanently to share stdout and stderr instead of putting it behind an environment variable?

Yes

vietjtnguyen commented 7 years ago

One problem with that is there are a few RuntimeWarning messages that come through stderr and show up as scary looking things when neovim gets started up:

screen shot 2017-06-23 at 7 58 14 pm

Here's the text:

Error detected while processing function <SNR>93_on_core_channel_error:
line    1:
/home/vnguyen/.config/nvim/bundle/clang_complete/pythonx/cm_sources/clang_complete.py:9: Runt
imeWarning: Parent module 'cm_sources' not found while handling absolute import^@  from cm im
port register_source, getLogger, Base^@/home/vnguyen/.config/nvim/bundle/clang_complete/pytho
nx/cm_sources/clang_complete.py:20: RuntimeWarning: Parent module 'cm_sources' not found whil
e handling absolute import^@  import sys^@/home/vnguyen/.config/nvim/bundle/clang_complete/py
thonx/cm_sources/clang_complete.py:21: RuntimeWarning: Parent module 'cm_sources' not found w
hile handling absolute import^@  import os^@/home/vnguyen/.config/nvim/bundle/clang_complete/
pythonx/cm_sources/clang_complete.py:22: RuntimeWarning: Parent module 'cm_sources' not found
 while handling absolute import^@  import libclang^@

I haven't spent the time to understand if they're normal or if I need to pay attention to them (since things are working).

roxma commented 7 years ago

Prepending from __future__ import absolute_import to pythonx/cm_sources/clang_complete.py seems to fix this issue.

vietjtnguyen commented 7 years ago

Yep, so it does. Want me to simplify this pull request to just turn on the stdout and stderr sharing and open another one for the from __future__ import absolute_import change to your clang_complete fork?

roxma commented 7 years ago

Merged.

Thanks.