From 1425a0f0203d25c4490bcdadf6bfd6354ed22714 Mon Sep 17 00:00:00 2001
From: Laura Abbott <lauraa@codeaurora.org>
Date: Thu, 22 May 2014 18:50:55 -0700
Subject: [PATCH] linux-ramdump-parser-v2: use sys.stdout as the default file

Some parsers may need to use the out file for their output. Currently,
when writing to stdout, we have 'None' as a parser which blows up
with dmesg parsing:

Traceback (most recent call last):
File "ramparse.py", line 318, in <module>
    p.cls(dump).parse()
File "dmesg.py", line 20, in parse
    dmesglib.DmesgLib(self.ramdump, print_out.out_file).extract_dmesg()
File "dmesglib.py", line 79, in extract_dmesg
    self.extract_dmesg_binary()
File "dmesglib.py", line 72, in extract_dmesg_binary
    self.outfile.write(f)
AttributeError: 'NoneType' object has no attribute 'write'

Make a default file of sys.stdout to do something reasonable when writing
to stdout. --stdout is mostly a debugging feature.

Change-Id: I8af80e1e6d79c4ef6660a536df02d26c28089760
---
 linux-ramdump-parser-v2/print_out.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-ramdump-parser-v2/print_out.py b/linux-ramdump-parser-v2/print_out.py
index 2f5635d..dc8854a 100644
--- a/linux-ramdump-parser-v2/print_out.py
+++ b/linux-ramdump-parser-v2/print_out.py
@@ -12,7 +12,7 @@ import sys
 import traceback
 from contextlib import contextmanager
 
-out_file = None
+out_file = sys.stdout
 
 def flush_outfile():
     if out_file is None:
-- 
GitLab