File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,17 @@ def main():
64
64
# but also makes it harder to deal with.
65
65
log_id = find_log_id (xcresult_path )
66
66
log = export_log (xcresult_path , log_id )
67
- sys .stdout .write (log )
67
+
68
+ # Avoid a potential UnicodeEncodeError raised by sys.stdout.write() by
69
+ # doing a relaxed encoding ourselves.
70
+ if hasattr (sys .stdout , 'buffer' ):
71
+ log_encoded = log .encode ('utf8' , errors = 'backslashreplace' )
72
+ sys .stdout .flush ()
73
+ sys .stdout .buffer .write (log_encoded )
74
+ else :
75
+ log_encoded = log .encode ('ascii' , errors = 'backslashreplace' )
76
+ log_decoded = log_encoded .decode ('ascii' , errors = 'strict' )
77
+ sys .stdout .write (log_decoded )
68
78
69
79
70
80
# Most flags on the xcodebuild command-line are uninteresting, so only pull
You can’t perform that action at this time.
0 commit comments