The 'osv trace2file' does not work with python3 so let us fix it by
replacing the code to open and write to a file with more portable
and succinct "with" construct.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 scripts/loader.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/scripts/loader.py b/scripts/loader.py
index 0ce782d0..97c831e9 100755
--- a/scripts/loader.py
+++ b/scripts/loader.py
@@ -1508,9 +1508,8 @@ class osv_trace_file(gdb.Command):
     def __init__(self):
         gdb.Command.__init__(self, 'osv trace2file', gdb.COMMAND_USER, 
gdb.COMPLETE_NONE)
     def invoke(self, arg, from_tty):
-        fout = file("trace.txt", "wt")
-        dump_trace(fout.write)
-        fout.close()
+        with open("trace.txt", 'wt') as fout:
+            dump_trace(fout.write)
 
 class osv_leak(gdb.Command):
     def __init__(self):
-- 
2.35.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20230404024308.169022-1-jwkozaczuk%40gmail.com.

Reply via email to