diff --git a/linux-ramdump-parser-v2/print_out.py b/linux-ramdump-parser-v2/print_out.py index 9a2698ef221542411d6836e1f0982ca39d300e83..2f5635de038dfec6956010a46bdb37f6b8e6331a 100644 --- a/linux-ramdump-parser-v2/print_out.py +++ b/linux-ramdump-parser-v2/print_out.py @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +# Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 and @@ -14,6 +14,11 @@ from contextlib import contextmanager out_file = None +def flush_outfile(): + if out_file is None: + sys.stdout.flush() + else: + out_file.flush() def set_outfile(path): global out_file diff --git a/linux-ramdump-parser-v2/ramparse.py b/linux-ramdump-parser-v2/ramparse.py index 0fe0c082a7ddb27382e1ab5601463aa62de8325b..d43712007e2ae5c3a4fd0fb88744741df431b076 100755 --- a/linux-ramdump-parser-v2/ramparse.py +++ b/linux-ramdump-parser-v2/ramparse.py @@ -26,7 +26,7 @@ from optparse import OptionParser import parser_util from ramdump import RamDump -from print_out import print_out_str, set_outfile, print_out_section, print_out_exception +from print_out import print_out_str, set_outfile, print_out_section, print_out_exception, flush_outfile # Please update version when something is changed!' VERSION = '2.0' @@ -322,6 +322,7 @@ if __name__ == '__main__': sys.stderr.write("FAILED! ") sys.stderr.write("%fs\n" % (time.time() - before)) sys.stderr.flush() + flush_outfile() sys.stderr.write("\n")