We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 338c474 commit 267db6dCopy full SHA for 267db6d
drgn_tools/printk.py
@@ -6,6 +6,7 @@
6
import argparse
7
import os
8
import subprocess
9
+import sys
10
from typing import Optional
11
12
from drgn import Program
@@ -42,4 +43,8 @@ class DmesgModule(CorelensModule):
42
43
name = "dmesg"
44
45
def run(self, prog: Program, args: argparse.Namespace) -> None:
- print(get_dmesg(prog).decode("utf-8"))
46
+ # Avoid the overhead of decoding and then re-encoding the bytes: just
47
+ # write the bytes directly to stdout. Also, avoid any encoding errors.
48
+ # There's no guaranteed encoding for the kernel log anyway.
49
+ sys.stdout.buffer.write(get_dmesg(prog))
50
+ print()
0 commit comments