##// END OF EJS Templates
Improve robustness, as suggested by Min.
Thomas Kluyver -
Show More
@@ -88,12 +88,12 b' def _find_cmd(cmd):'
88 88
89 89 def _system_body(p):
90 90 """Callback for _system."""
91 enc = sys.stdin.encoding
91 enc = sys.stdin.encoding or sys.getdefaultencoding()
92 92 for line in read_no_interrupt(p.stdout).splitlines():
93 line = line.decode(enc)
93 line = line.decode(enc, 'replace')
94 94 print(line, file=sys.stdout)
95 95 for line in read_no_interrupt(p.stderr).splitlines():
96 line = line.decode(enc)
96 line = line.decode(enc, 'replace')
97 97 print(line, file=sys.stderr)
98 98
99 99
@@ -44,6 +44,10 b' class OutStream(object):'
44 44 else:
45 45 data = self._buffer.getvalue()
46 46 if data:
47 # Make sure that we're handling unicode
48 if not isinstance(data, unicode):
49 enc = sys.stdin.encoding or sys.getdefaultencoding()
50 data = data.decode(enc, 'replace')
47 51 content = {u'name':self.name, u'data':data}
48 52 msg = self.session.send(self.pub_socket, u'stream',
49 53 content=content,
General Comments 0
You need to be logged in to leave comments. Login now