2
0
mirror of https://github.com/mhinz/neovim-remote synced 2024-11-11 13:10:34 +00:00

Print "access denied" errors in --serverlist to stderr

This commit is contained in:
Marco Hinz 2019-11-25 13:28:30 +01:00
parent e7e001a03a
commit 7b9c4b2b8a
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

View File

@ -357,6 +357,7 @@ def split_cmds_from_files(args):
def print_addresses(): def print_addresses():
addresses = [] addresses = []
errors = []
for proc in psutil.process_iter(attrs=['name']): for proc in psutil.process_iter(attrs=['name']):
if proc.info['name'] == 'nvim': if proc.info['name'] == 'nvim':
@ -369,10 +370,12 @@ def print_addresses():
if conn.laddr: if conn.laddr:
addresses.insert(0, conn.laddr) addresses.insert(0, conn.laddr)
except psutil.AccessDenied: except psutil.AccessDenied:
addresses.insert(0, 'Access denied for nvim ({})'.format(proc.pid)) errors.insert(0, 'Access denied for nvim ({})'.format(proc.pid))
for addr in sorted(addresses): for addr in sorted(addresses):
print(addr) print(addr)
for error in sorted(errors):
print(error, file=sys.stderr)
def parse_address(address): def parse_address(address):