Skip to content
Snippets Groups Projects
Commit aed440e0 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

lrdp-v2: provide method for flushing outfile

Sometimes it's useful to force a flush of the global outfile. Provide a
method to do so and use it in the main parser loop.

Change-Id: I18e9a07345c852d498b131b442df5a0c95bbcf98
parent 9cebcb69
No related branches found
No related tags found
No related merge requests found
# 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
......
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment