in scripts/xcresult_logs.py [0:0]
def main():
args = sys.argv[1:]
if not args:
sys.stdout.write(__doc__)
sys.exit(1)
logging.basicConfig(format='%(message)s', level=logging.DEBUG)
flags = parse_xcodebuild_flags(args)
# If the result bundle path is specified in the xcodebuild flags, use that
# otherwise, deduce
xcresult_path = flags.get('-resultBundlePath')
if xcresult_path is None:
project = project_from_workspace_path(flags['-workspace'])
scheme = flags['-scheme']
xcresult_path = find_xcresult_path(project, scheme)
log_id = find_log_id(xcresult_path)
log = export_log(xcresult_path, log_id)
# Avoid a potential UnicodeEncodeError raised by sys.stdout.write() by
# doing a relaxed encoding ourselves.
if hasattr(sys.stdout, 'buffer'):
log_encoded = log.encode('utf8', errors='backslashreplace')
sys.stdout.flush()
sys.stdout.buffer.write(log_encoded)
else:
log_encoded = log.encode('ascii', errors='backslashreplace')
log_decoded = log_encoded.decode('ascii', errors='strict')
sys.stdout.write(log_decoded)