pythonic-emacs / anaconda-mode

Code navigation, documentation lookup and completion for Python.
GNU General Public License v3.0
706 stars 87 forks source link

anaconda-mode logs anaconda-mode-server-command to systemctl status #406

Closed timlod closed 3 years ago

timlod commented 3 years ago

We have noticed that whenever anaconda-mode is running, the entirety of anaconda-mode-server-command shows up in the systemctl status under the ipython process. We are on a multi-user server with several instances of anaconda-mode, and the systemctl status output is thus quite polluted.

The log will look something like this:

           │ │ │ │ ├─ 2462 /usr/local/bin/emacs --daemon
           │ │ │ │ ├─16926 /home/tim/miniconda3/bin/python /home/tim/miniconda3/bin/ipython -c 
from __future__ import print_function
import sys
import os
from distutils.version import LooseVersion
...
...

Can we somehow prevent this from happening? Running emacs 27.1 as a daemon.

timlod commented 3 years ago

Actually, you see this with ps x as well, although there it is OK since the definition is on one line, instead of systemctl status's multiline output. Would it be possible to wrap that module inside another script that is called instead to prevent this?

dakra commented 3 years ago

This is a duplicate of #393.

Putting it inside another script is certainly possible but you have to be careful that it still works over tramp.

timlod commented 3 years ago

I'm not very experienced with elisp that touches outside processes - could you give me a pointer on how I could have that module external? Then I could submit a PR for that.

Edit: I have found how to wrap it in a script - I replaced

:args `("-c"
            ,anaconda-mode-server-command

with

:args `(,(concat (file-name-directory (locate-library "anaconda-mode")) "anaconda-mode.py")

where anaconda-mode.py wraps that script. But as expected, it won't work over TRAMP, as I suppose the filename is expanded with the current TRAMP prefix...

dakra commented 3 years ago

Maybe a simple solution is to check (pythonic-remote-p) and if that's true, send the content of anaconda-mode.py instead of passing the filename.

Other option would be to copy the file to the remote host first?!

timlod commented 3 years ago

I made a pull request fixing this - #407. It's my first change of this kind, so it may not be exactly what you're looking for - let me know!

dakra commented 3 years ago

Thanks. Had a quick look and lgtm. I'm pretty busy atm, so in case @CeleritasCelery isn't faster than me it'll take some time for a proper review.

dakra commented 3 years ago

Fixed in #407