소스 검색

Merge pull request #166 from orchardup/utf8-fixes

Fix UnicodeEncodeErrors in output of 'build', 'run' and 'up'
Aanand Prasad 11 년 전
부모
커밋
401ea4e7a8
3개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      fig/cli/log_printer.py
  2. 1 1
      fig/cli/socketclient.py
  3. 1 1
      fig/service.py

+ 1 - 1
fig/cli/log_printer.py

@@ -18,7 +18,7 @@ class LogPrinter(object):
     def run(self):
         mux = Multiplexer(self.generators)
         for line in mux.loop():
-            sys.stdout.write(line)
+            sys.stdout.write(line.encode(sys.__stdout__.encoding or 'utf8'))
 
     def _make_log_generators(self):
         color_fns = cycle(colors.rainbow())

+ 1 - 1
fig/cli/socketclient.py

@@ -81,7 +81,7 @@ class SocketClient:
                 chunk = socket.recv(4096)
 
                 if chunk:
-                    stream.write(chunk)
+                    stream.write(chunk.encode(stream.encoding or 'utf8'))
                     stream.flush()
                 else:
                     break

+ 1 - 1
fig/service.py

@@ -295,7 +295,7 @@ class Service(object):
                 match = re.search(r'Successfully built ([0-9a-f]+)', line)
                 if match:
                     image_id = match.group(1)
-            sys.stdout.write(line)
+            sys.stdout.write(line.encode(sys.__stdout__.encoding or 'utf8'))
 
         if image_id is None:
             raise BuildError()