WebKit Bugzilla
Attachment 357473 Details for
Bug 192775
: webkitpy: Handle case where stdout and stderr don't accept unicode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192775-20181217135413.patch (text/plain), 2.95 KB, created by
Jonathan Bedard
on 2018-12-17 13:54:13 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jonathan Bedard
Created:
2018-12-17 13:54:13 PST
Size:
2.95 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 239288) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2018-12-17 Jonathan Bedard <jbedard@apple.com> >+ >+ webkitpy: Handle case where stdout and stderr don't accept unicode >+ https://bugs.webkit.org/show_bug.cgi?id=192775 >+ <rdar://problem/46497303> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/webkitpy/layout_tests/views/metered_stream.py: >+ (MeteredStream.write): If unicode cannot be written to the stream, replace unicode >+ characters with '?'. >+ * Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py: >+ (RegularTest.test_stream_with_encoding): >+ > 2018-12-17 Daniel Bates <dabates@apple.com> > > Support concatenating StringView with other string types >Index: Tools/Scripts/webkitpy/layout_tests/views/metered_stream.py >=================================================================== >--- Tools/Scripts/webkitpy/layout_tests/views/metered_stream.py (revision 239278) >+++ Tools/Scripts/webkitpy/layout_tests/views/metered_stream.py (working copy) >@@ -107,7 +107,16 @@ class MeteredStream(object): > if not self._isatty or self._verbose: > txt = self._ensure_newline(txt) > >- self._stream.write(timestamp_string + txt) >+ try: >+ self._stream.write(timestamp_string + txt) >+ except UnicodeEncodeError: >+ output = '' >+ for c in timestamp_string + txt: >+ try: >+ output += '{}'.format(c) >+ except UnicodeEncodeError: >+ output += '?' >+ self._stream.write(output) > > def writeln(self, txt, now=None, pid=None): > self.write(self._ensure_newline(txt), now, pid) >Index: Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py >=================================================================== >--- Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py (revision 239278) >+++ Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py (working copy) >@@ -117,6 +117,24 @@ class RegularTest(unittest.TestCase): > self.logger.info('âexampleâ') > self.assertEqual(self.buflist[-1][-14:], 'âexampleâ\n') > >+ def test_stream_with_encoding(self): >+ class AsciiStream(StringIO.StringIO): >+ def write(self, s): >+ return StringIO.StringIO.write(self, '{}'.format(s)) >+ >+ stream = AsciiStream() >+ >+ logger = logging.getLogger(__name__) >+ logger.setLevel(logging.DEBUG) >+ logger.propagate = False >+ >+ try: >+ meter = MeteredStream(stream, self.verbose, logger, self.time_fn, 8675, print_timestamps=self.print_timestamps) >+ self.logger.info(u'\u2713') >+ self.assertEqual(stream.buflist[-1][-2:], '?\n') >+ finally: >+ meter.cleanup() >+ > > class TtyTest(RegularTest): > verbose = False
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192775
: 357473