Print a couple of errors to stderr instead of stdout

This commit is contained in:
Kovid Goyal 2018-03-04 08:58:36 +05:30
parent 28c1935800
commit 976c322b83
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@
import atexit
import re
import socket
import sys
from functools import partial
from gettext import gettext as _
from weakref import WeakValueDictionary
@ -213,7 +214,7 @@ class Boss:
session = create_session(opts, args)
self.add_os_window(session, wclass=args.cls, wname=args.name, size=initial_window_size(opts, self.cached_values), startup_id=startup_id)
else:
safe_print('Unknown message received from peer, ignoring')
safe_print('Unknown message received from peer, ignoring', file=sys.stderr)
def handle_remote_cmd(self, cmd, window=None):
response = self._handle_remote_command(cmd, window)

View File

@ -3,7 +3,8 @@
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
import re
from binascii import unhexlify, hexlify
import sys
from binascii import hexlify, unhexlify
def safe_print(*a, **k):
@ -459,7 +460,7 @@ def get_capabilities(query_string):
qname = termcap_aliases[name]
val = queryable_capabilities[qname]
except Exception as e:
safe_print(ERROR_PREFIX, 'Unknown terminfo property:', name)
safe_print(ERROR_PREFIX, 'Unknown terminfo property:', name, file=sys.stderr)
raise
if qname in string_capabilities and '%' not in val:
val = key_as_bytes(qname).decode('ascii')