Index: tools/scan-build-py/libear/__init__.py =================================================================== --- tools/scan-build-py/libear/__init__.py +++ tools/scan-build-py/libear/__init__.py @@ -207,9 +207,9 @@ if m: key = m.group(1) if key not in definitions or not definitions[key]: - return '/* #undef {} */\n'.format(key) + return '/* #undef {0} */{1}'.format(key, os.linesep) else: - return '#define {}\n'.format(key) + return '#define {0}{1}'.format(key, os.linesep) return line with open(template, 'r') as src_handle: Index: tools/scan-build-py/libscanbuild/report.py =================================================================== --- tools/scan-build-py/libscanbuild/report.py +++ tools/scan-build-py/libscanbuild/report.py @@ -336,11 +336,12 @@ match = re.match(r'(.*)\.info\.txt', filename) name = match.group(1) if match else None - with open(filename) as handler: - lines = handler.readlines() + with open(filename, mode='rb') as handler: + # this is a workaround to fix windows read '\r\n' as new lines + lines = [line.decode().rstrip() for line in handler.readlines()] return { - 'source': lines[0].rstrip(), - 'problem': lines[1].rstrip(), + 'source': lines[0], + 'problem': lines[1], 'file': name, 'info': name + '.info.txt', 'stderr': name + '.stderr.txt'