From 7b9c4b2b8a5e31c829ea9033b81e0d8f37175649 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 25 Nov 2019 13:28:30 +0100 Subject: [PATCH] Print "access denied" errors in --serverlist to stderr --- nvr/nvr.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nvr/nvr.py b/nvr/nvr.py index c0bb9c7..1cf0b89 100644 --- a/nvr/nvr.py +++ b/nvr/nvr.py @@ -357,6 +357,7 @@ def split_cmds_from_files(args): def print_addresses(): addresses = [] + errors = [] for proc in psutil.process_iter(attrs=['name']): if proc.info['name'] == 'nvim': @@ -369,10 +370,12 @@ def print_addresses(): if conn.laddr: addresses.insert(0, conn.laddr) 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): print(addr) + for error in sorted(errors): + print(error, file=sys.stderr) def parse_address(address):