فهرست منبع

remote stderr: keep line endings as is

so even the \r trick works for overwriting the same line.
Thomas Waldmann 10 سال پیش
والد
کامیت
2df0bb1f83
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      borg/remote.py

+ 3 - 3
borg/remote.py

@@ -264,13 +264,13 @@ class RemoteRepository:
                     if not data:
                         raise ConnectionClosed()
                     data = data.decode('utf-8')
-                    for line in data.splitlines():
+                    for line in data.splitlines(keepends=True):
                         if line.startswith('$LOG '):
                             _, level, msg = line.split(' ', 2)
                             level = getattr(logging, level, logging.CRITICAL)  # str -> int
-                            logging.log(level, msg)
+                            logging.log(level, msg.rstrip())
                         else:
-                            print("Remote: " + line, file=sys.stderr)
+                            sys.stderr.write("Remote: " + line)
             if w:
                 while not self.to_send and (calls or self.preload_ids) and len(waiting_for) < 100:
                     if calls: